$images = array(); function add_image($im_url, $tm_url, $im_desc){ if (is_array($images)){ $c = sizeof($images); print "$c <br />"; $images[$c] = array(); $images[$c][0] = $im_url; $images[$c][1] = $tm_url; $images[$c][2] = $im_desc; } else { print "Not array!!!"; } }
When the add_image function is called, i get not array as a return.... Can anyone please help me out? Thanks for your time ~Gabor
$images is NOT a variable local to your function.
Declare it as global, both inside and outside the array
global $images; $images = array();
function add_image($im_url, $tm_url, $im_desc){ global $images;
Or even better, send the array into the function and catch it afterwards
$images = array(); function add_image($im_url, $tm_url, $im_desc, $images){ do something return $images; } $images = add_image($images);