#10967 [Com]: $x .= &someFunction();

From: Date: Tue, 20 Jul 2004 15:03:58 +0000
Subject: #10967 [Com]: $x .= &someFunction();
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-62897@lists.php.net to get a copy of this message
ID: 10967 Comment by: winfrey-oprah974 at hotmail dot com Reported By: fabiankessler at usa dot net Status: Bogus Bug Type: Scripting Engine problem Operating System: win2k PHP Version: 4.0.5 New Comment: <a href=http://nasty-pvc-double-p.da.ru>oprah winfrey</a> Previous Comments: ------------------------------------------------------------------------ [2001-07-09 08:37:50] jeroen@php.net This is nonsense, what do you expect of $x .= &somefunction()? that the second part of $x gets referenced? ------------------------------------------------------------------------ [2001-06-12 15:36:34] jmoore@php.net well your playing with references where they are not needed.. expect to get your fingers burnt. ------------------------------------------------------------------------ [2001-05-22 16:50:28] fabiankessler at usa dot net uhm, well, the thing with the $temp var is useless. i see now that i cannot reference something into *a part* of something else. but the silent loss of "<br>\n" is still a problem, imo. fab ------------------------------------------------------------------------ [2001-05-18 23:41:12] fabiankessler at usa dot net code i would like to use: ---cut--- function &someShit() { return 'foo'; } $out = ''; for ($i = 1; $i <= 3; $i++) { $out .= &someShit() . "<br>\n"; } echo $out; ---cut--- problem: parse error on line $out .= &someShit() . "<br>\n"; because .= and & don't work together. so the workaround would be: $temp = &someShit() . "<br>\n"; $out .= $temp; problem here: it prints out 'foofoofoo' and not 'foo<br>\nfoo<br>\nfoo<br>\n' so the code finally looks like: ---cut--- function &someShit() { return 'foo'; } $out = ''; for ($i = 1; $i <= 3; $i++) { $temp = &someShit(); $out .= $temp . "<br>\n"; } echo $out; ---cut--- is this the normal behavior? fab ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=10967&edit=1

« previous php.bugs (#62897) next »