Returning arrays from a function?

From: Date: Tue, 07 Aug 2001 09:09:09 +0000
Subject: Returning arrays from a function?
Groups: php.general 
Request: Send a blank email to php-general+get-61567@lists.php.net to get a copy of this message
What could be wrong when I don't get any results from an array made from whitin a function? function test_print($item, y){ if (ereg("[0-9]", $item)) { $numa[$i] = $item; echo $GLOBALS["i"] . " - $numa[$i]\n"; $GLOBALS["i"]++; } Printing from within this function works fine, but when I want to do the same output outside the function I get nothing. How can I return the array outside the function? This is how I call the script: while (list ($line_num, $line) = each ($fcontents)) { if ($line_num == 7) { $min = explode (" ", $line); array_walk ($min, 'test_print'); reset ($min); } if ($line_num == 8) { $max = explode (" ", $line); array_walk($max, 'test_print'); reset ($max); } if ($line_num > 8) break; set_time_limit(160); }

« previous php.general (#61567) next »