What is happening here? Can't figure out why it can't echo text if there is something right after <
I know i can use < but whats special about < ??
<? $str = "a <abc"; $str1 = "a < abc"; echo $str; echo "<br />"; echo $str1; ?>
Output:
a a < abc
The browser is doing that. "<" tells it that an html tag is starting. Run this and you'll see that PHP is sending it to the browser:
$str = "a <abc"; echo htmlentities($str);
Thanks, just checked the html source and it does show a <abc
<?php $str = htmlspecialchars("a <abc"); $str1 = htmlspecialchars("a < abc"); echo $str; echo "<br />"; echo $str1; ?>