Welcome to WebmasterWorld Guest from 54.196.231.129

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

weird error while concatenate string

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

Junior Member

5+ Year Member

joined:Nov 16, 2008
posts: 136
votes: 0


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 Sept 19, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Dec 13, 2009
posts:943
votes: 0


Might be output buffering?

Try this:

echo $str;
flush();
if(ob_get_level() > 0) { ob_flush(); }
7:04 pm on Sept 19, 2013 (gmt 0)

Junior Member

5+ Year Member

joined:Nov 16, 2008
posts: 136
votes: 0


never thought of it.. i had special characters in some string.. thanks
2:06 pm on Sept 22, 2013 (gmt 0)

Senior Member

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

joined:July 3, 2006
posts: 3123
votes: 0


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