|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-05-22 16:50 UTC] fabiankessler at usa dot net
[2001-06-12 15:36 UTC] jmoore@php.net
[2001-07-09 08:37 UTC] jeroen@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 12:00:01 2025 UTC |
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