I have tried both ways to loop through an array and output the data and
verify that the array is an array and I get no erros but I get this
value, which should not be so.
Here I'm checking if it's an array:
if (!is_array($ID_arr)) { # show error if no array
echo '$ID_arr is not an array.';
}
here I'm counting the keys but it only outputs as 1:
$key = count($ID_arr);
echo $key;
here are two loops that do the same thing and they both output Array:
for($i = 0; $i < count($ID_arr); $i++) {
echo $ID_arr[$i];
}
foreach($ID_arr as $ind_picture) {
echo $ind_picture;
}
Why? If it helps, in order to get the array, the values were taken from
a database and exploded from a coma delimited string.
$ID_arr[] = explode(',', $pictures); # make db data into array
This is the string:
15,16,17,18,19
I want each array element to contain
=> 15
=> 16
=> 17
etc...
why does it echo as Array?
- Victor > www.argilent.com
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php