Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Strange output from echo statement
July 23, 2004, 4:52 pm
rate this thread
output. After echoing the variable the rest of the line is ignored.
$var1 = "test";
echo "This is a " . $var1 . "! This is only a " . $var1;
This is a test
This is a test! This is only a test.
//At first I corrected the problem by bypassing it like so:
$var1 = "test";
echo "This is a " . $var1;
echo "! This is only a " . $var1;
//thought it was just a weird nuance, but the fact that it's doing similar
things with my pattern matches, it has to be something else.
$pattern = '<tr><td>(.*)</td></tr>';
$string = '<tr><td>Test Status</td></tr><tr><td class=\"classy\">Test
eregi($pattern, $string, $output);//just an example, won't work for
//running thru eregi returns
<tr><td>Test Status</td></tr><tr><td class=\"classy\">Test Date</td></tr>
//AND everything else following the (*) in $pattern!
I'm really at a loss as to why this is like this!
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Re: Strange output from echo statement
What version of PHP are you using?
I cut and pasted your code into a page (on a server running v4.3.4) and
it returned the full string as it should.
BTW if you are keeping the variables outside the strings, use single
quotes instead of double quotes - this will prevent PHP from having to
parse the contents of the string. Alternatively you could have written:
echo "This is a $var1! This is only a $var1";
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum