Bug #10967 Updated: $x .= &someFunction();
| From: | fabiankessler at usa dot net | Date: | Tue, 22 May 2001 14:50:28 +0000 |
| Subject: | Bug #10967 Updated: $x .= &someFunction(); | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-56280@lists.php.net to get a copy of this message | ||
ID: 10967
User Update by: fabiankessler@usa.net
Status: Open
Bug Type: Scripting Engine problem
Operating system: win2k
PHP Version: 4.0.5
Description: $x .= &someFunction();
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
Previous Comments:
---------------------------------------------------------------------------
[2001-05-18 23:41:12] fabiankessler@usa.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
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=10967