function foo(){ echo "foo"; } echo foo();
The foo() doesn't return the (non-existant) value from echo, it simply echo()s and returns nothing, and there's nothing wrong with echo()ing nothing. It would fail if you were using
function foo(){ return echo "foo"; } echo foo();
Daevid Vincent wrote:
Mmm. I'm still not following and not completely convinced.
Changing "echo alarmLightYMD();" to simply "alarmLightYMD();" in the bottom function doesn't print anything in the table cell at all (for the first test case).
While your idea at first makes sense and does seem like a newbie mistake (and you are correct, I do have nested "echo" statements come to think of it). What I don't get is why it's not consistent. "Expanding" the relevant lines, it should be like this:
echo "<TD>".(echo "<IMG SRC='images/light_red.gif'>")."</TD>";
Which fails, and the other line would be (which works):
<TD><?php echo (echo "<IMG SRC='images/light_red.gif'>"); ?></TD>
In my book, they're both double echoing the output if you will... Are you with me on that?
So again, why does the second one work and the first one doesn't?
-----Original Message-----
From: Philip Hallstrom [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2003 5:20 PM
To: Daevid Vincent
Cc: [EMAIL PROTECTED]
Subject: [PHP] Re: Found a bug in 4.2.3 re: <TD> and echo vs. <?php?>
It's a coding error... at least I think so.
change alarmLightMySQL just return the results not "echo" them... echoing
them doesn't make much sense inside another echo statement...
On Fri, 4 Apr 2003, Daevid Vincent wrote:
Here, try this bullshit...control of the
I can't upgrade to a more recent version as I'm not in
server, but I've tried it with both 4.1.2 and 4.2.3 onlinux with a RH
install. Can anyone confirm or dispute this bug exists inlater versions?
How does a parsing error like this go un-noticed for so long?and so that can't
Obviously I took out all the interesting stuff in the page
be blamed. This is about as bare skeleton test case as you can get.all sides by the
*sigh*
------------snip----------------
<?php function alarmLightYMD() { return "<IMG SRC='images/light_red.gif'>"; }
function alarmLightMySQL() { echo alarmLightYMD(); } ?> <html> <head> <title>FUCKED UP PHP Bug #1234170238741023</title> </head>
<body> PHP Version 4.1.2<BR> PHP Version 4.2.3<BR> <BR> Why the FUCK doesn't this work!!!! <P> <TABLE BORDER="1"> <?php for ($i = 0; $i < 10; $i++ ) { echo "<TR>"; echo "<TD>".alarmLightMySQL()."</TD>"; echo "<TD>this fails!</TD>"; echo "</TR>"; } ?> </TABLE>
<HR>
YET THIS DOES! <P> <TABLE BORDER="1"> <?php for ($i = 0; $i < 10; $i++ ) { ?> <TR> <TD><?php echo alarmLightMySQL(); ?></TD> <TD>this works</TD> </TR> <?php } ?> </TABLE> </body> </html>
------------snip----------------
"Ezekiel 25:17. The path of the righteous man is beset on
inequities of the selfish and the tyranny of evil men.Blessed is he who in
the name of charity and goodwill shepherds the weak throughthe valley of
darkness, for he is TRULY his brother's keeper and thefinder of lost
children. And I will strike down upon thee with GREAT vengeance anddestroy my brothers!
FU-U-U-URIOUS anger, those who attempt to poison, and
And you will KNOW my name is the Lord, when I lay myvengeance upon thee!"
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.