This is driving me nuts.. I know it's something really obvious but when I run this code it prints nothing :
<?php
$Test="hello";
$request="<a";
print_r($request);
exit;
?>
The only way it prints is if I put a space after the angle bracket like this:
<?php
$Test="hello";
$request="< a";
print_r($request);
exit;
?>
Anyone know what the problem is ??
Thanks in advance
Joe
Quoted string with angle bracket won't print without space
Moderator: General Moderators
-
joeshmoe666
- Forum Newbie
- Posts: 7
- Joined: Sat Sep 12, 2009 2:02 pm
Re: Quoted string with angle bracket won't print without space
The <a is there - you're just not seeing it. It's being interpreted as HTML markup. Check the HTML source of the page.
Code: Select all
$request=htmlentities("<a"); // <a-
joeshmoe666
- Forum Newbie
- Posts: 7
- Joined: Sat Sep 12, 2009 2:02 pm
Re: Quoted string with angle bracket won't print without space
Afraid that's not it .. put any character instead of the a and it still does the same thing .. and even if it were reading it as html it should still output it since it's a quoted string..
Re: Quoted string with angle bracket won't print without space
did you try it?
-
joeshmoe666
- Forum Newbie
- Posts: 7
- Joined: Sat Sep 12, 2009 2:02 pm
Re: Quoted string with angle bracket won't print without space
Sorry .. you're right .. the original problem was I was sending XML to a server and getting an error so I was trying to print out the xml to my screen so I could see if it was formed correctly .. and of course you're right that you can't view the xml that way since it has the < in it .. I can print it to the screen and view it with page source though .. so now I can get back to the original problem .. interesting side track though .. arghh!!
Thanks
Thanks