Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

something weird with echo - where's the rest of the string?

Status
Not open for further replies.

rybo

Technical User
Jun 8, 2002
36
US
I'm getting something very un-expected and would greatly appreciate help...

if I do the following:

<?php
$temp=&quot;From: <someone@somewhere.com>\r\n&quot;;
echo $temp;
?>

...it prints to the screen the following:

From:

...so where did the rest of it go? How do I get the whole line to print, or more specifically, how can I return $temp from a function with the entire line? The really weird thing is if you do strlen($temp) right after the echo $temp, it will give you the lenght of the whole thing (yet only prints the first 5 characters). I'm sure it's something simple, but I've beat my head against a wall for hours.

Thanks
 
Try this:
Code:
echo &quot;<pre>&quot; . str_replace(&quot;<&quot;, &quot;&lt;&quot;, str_replace(&quot;>&quot;, &quot;&gt;&quot;, $temp)) . &quot;</pre>&quot;;
//Daniel
 
This is because < is parsed by your browser as a tag, if you want to view the site as plain text (implied above), add the following to the top of the code (before ANYTHING).

header(&quot;Content-type: plain/text&quot;); --BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top