- neden strip_tags belirli dize içeriğini karşılaşıldığında erken döner?

0 Cevap php

everyone, I'm sure this is a feature and not a bug, and I'm overlooking something obvious here. But I just can't see it.

Ben kısa etiketleri sarılı bazı PHP malzeme ile biberli HTML oluşur aşağıdaki kodu var:

$wtf = <<<WTF
<h1>First header</h1>
<p class="intro">First line of text</p>
<h2>Second header</h2>
<p>Second line of text</p>
<?= showImg ('image.jpg'); ?>
<p>Third line of text</p>
<?= showImg ('image.jpg', ''); ?>
<p>Fourth line of text</p>
<?= showImg ('image.jpg', '', ''); ?>
<p>Fifth line of text</p>
<?= showImg ('image.jpg', '', 'class="content"'); ?>
<p>Sixth line of text</p>
WTF;
echo strip_tags ($wtf);[/CODE]

Bu aşağıdaki çıktılar:

First header
First line of text
Second header
Second line of text

Third line of text

Fourth line of text

Fifth line of text[/CODE]

Gördüğünüz gibi metin altıncı hat çıkışı dahil değildir. Suçlu önceki hattı,

<?= showImg ('image.jpg', '', 'class="content"'); ?>

ya da daha doğrusu, showImg () çağrısında üçüncü parametre. En kısa zamanda () bu bölümünü karşılaştığında strip_tags gibi, sadece bir hata mesajı görüntüleniyor sonlandırılıyor ve bugüne kadar işlenmiş metni verir - her nasılsa o işlemek gerekiyordu verinin sonuna karşılaştı sahip inanıyor inanmak için bana yol açar.

Neden?

Incidentally, the bit itself works fine when I run it, and even with full error reporting generates no syntax-related warnings or errors, so I believe it's valid and allowable syntax. Yes, I am aware of the whole semi-religious discussion on whether or not using short tags are a good idea, but right now I am using it and all I want to know is why strip_tags returns prematurely when it encounters that third parameter in the showImg() call.

Google, other forums and a search on StackOverflow have not resulted in enlightenment. Can anyone tell me what's going on here? Thanks - it would be greatly appreciated!

/ / Frank

0 Cevap