Forum Moderators: coopster

Message Too Old, No Replies

weird error while concatenate string

         

skoff

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

10+ 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?

Readie

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

WebmasterWorld Senior Member 10+ Year Member



Might be output buffering?

Try this:

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

skoff

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

10+ Year Member



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

penders

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

WebmasterWorld Senior Member 10+ 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)?