|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15030 echo concatenates strings and string function call in bad order
Submitted: 2002-01-14 10:09 UTC Modified: 2002-01-14 14:25 UTC
From: ivosh at winet dot cz Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.0.6 OS: Debian Linux
Private report: No CVE-ID: None
 [2002-01-14 10:09 UTC] ivosh at winet dot cz
<? function Translate($R)
     { echo $R; } 
   echo "<i>".Translate("This should be in italics, but -- weird! -- it's normal.")."</i> "; ?>   


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-14 10:12 UTC]
User error, go read
 [2002-01-14 14:25 UTC]
just a short explaination: echo contatenates nothing, 
it *immediately* generates the requested output
plus arguments are evaluated before they are passed 
to a function (lets assume "echo" is a function for

so before "echo" is called the argument string is 
evaluated, for this Translate() is called, which
itself contains an echo call which is executed first now

what you wand is "return $R;" instead of "echo $R;"
in Translate()
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 18:01:31 2024 UTC