php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #25459 expressions, echo/return and strings
Submitted: 2003-09-09 13:35 UTC Modified: 2003-09-10 01:24 UTC
From: blackei2k at gmx dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 4.3.2 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: blackei2k at gmx dot de
New email:
PHP Version: OS:

 

 [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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-09 17:19 UTC] kennyt at kennyt dot com
function foo()
{
 echo "foo";
}

this should be
function foo() {
  return 'foo';
}

that's why your output isn't within the <td/> tag.
 [2003-09-09 17:21 UTC] kennyt at kennyt dot com
and that really should be '<td>' and '<td>haha</td>' :-)
 [2003-09-10 01:24 UTC] pollita@php.net
Nice to see you again philip, but this "bug" is 'Bogus'.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 18:01:33 2024 UTC