Bug #10967: $x .= &someFunction();

From: Date: Sat, 19 May 2001 03:41:13 +0000
Subject: Bug #10967: $x .= &someFunction();
Groups: php.dev 
Request: Send a blank email to php-dev+get-55865@lists.php.net to get a copy of this message
From: fabiankessler@usa.net Operating system: win2k PHP version: 4.0.5 PHP Bug Type: Scripting Engine problem Bug description: $x .= &someFunction(); 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 Bug report at: http://bugs.php.net/?id=10967&edit=1

« previous php.dev (#55865) next »