|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-09-09 13:35 UTC] blackei2k at gmx dot de
Description:
------------
I'm using the ternary operator which calls a function. The output is not there where it should be, but a few liens above. I don't get any errors.
Reproduce code:
---------------
function foo()
{
echo "foo";
}
...
while($obj = mysql_fetch_object($result)){
echo ($obj->id == $id ? "<td>".foo()."</td>" : "<td>haha</td>");
}
Expected result:
----------------
that the output is where it should be.
i'm listing rows and only in one row ($obj->id == $id) is true.
the output of foo can be found dozens of lines above from where it should be.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 19:00:01 2025 UTC |
function foo() { echo "foo"; } this should be function foo() { return 'foo'; } that's why your output isn't within the <td/> tag.