|
Posted by robert on 05/04/06 16:54
| function echoarray($var){
|
| foreach( $var as $name ){
|
| echo "$name<br><br>";
|
| }
|
| }
|
| if ($db){ echo "Problem"; }
|
| the result is:
|
| Peter
|
| Paul
|
| Mary
| So I can't figure out how exactly, when the function does execute, I'm
| still getting the error message. Any ideas?
moments like this make me chuckle. ;^)
echoarray() doesn't return anything! and, no matter what, it always echos
data to the browser/output buffer. if you put "return true;" as the last
executed line within the body of that function, then it would behave more
like you're expecting.
try this:
function echoArray($array)
{
if (!is_array($array)){ return false; }
echo implode("<br><br>\n", $array);
return true;
}
hth,
me
Navigation:
[Reply to this message]
|