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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
3 + 50 = ?
Subscribe to this entry?

 
 [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-2022 The PHP Group
All rights reserved.
Last updated: Fri Jan 21 03:03:34 2022 UTC