Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

weird error while concatenate string



3:16 pm on Sep 19, 2013 (gmt 0)

5+ Year Member

here's my code :
$str = "";
foreach($arr as $r) {
$str .= '<option value="'.$r["idField"].'">'.$r["name"].'<option>';
echo $str;

i checked my array and its populated.
i've done this a million time... but there's no echo of it.. the only difference is that i use XAMPP on windows... normally i'm on linux. Is there any settings i need to change so it can work?


6:11 pm on Sep 19, 2013 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member

Might be output buffering?

Try this:

echo $str;
if(ob_get_level() > 0) { ob_flush(); }


7:04 pm on Sep 19, 2013 (gmt 0)

5+ Year Member

never thought of it.. i had special characters in some string.. thanks


2:06 pm on Sep 22, 2013 (gmt 0)

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

Just curious... what was the "weird error"? Or was it that it simply didn't work as expected (no error)?

Featured Threads

Hot Threads This Week

Hot Threads This Month