php.net |  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> "; ?>   

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-14 10:12 UTC] derick@php.net
User error, go read www.php.net/echo
Bogus
 [2002-01-14 14:25 UTC] hholzgra@php.net
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
now)

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: Tue Apr 16 14:01:29 2024 UTC