print "$array[$i][0]" pukes

From: Date: Thu, 06 Mar 2003 02:12:26 +0000
Subject: print "$array[$i][0]" pukes
Groups: php.general 
Request: Send a blank email to php-general+get-138402@lists.php.net to get a copy of this message
Hi, all -- I have a two-dimensional array built from reading a file and I'm having trouble accessing a value of an inner array. I know, particularly with some help from print_r(), that the arrays are filled in properly. I can do $m = count($manilist) ; for ( $i=0 ; $i<$m ; $i++ ) { $ml = $manilist[$i] ; print "$i :: $ml[0]\n" ; } and get the expected 0th values of each of the inner arrays, but when I try $m = count($manilist) ; for ( $i=0 ; $i<$m ; $i++ ) { print "$i :: $manilist[$i][0]\n" ; } I simply get 'Array[0]' out for each inner.. Clearly php is seeing that $manilist[$i] is an array, telling me so, and then happily printing the "[0]"; how do I get to the value itself without having to use a temporary array? TIA & HAND :-D -- David T-G * There is too much animal courage in (play) davidtg@justpickone.org * society and not sufficient moral courage. (work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

« previous php.general (#138402) next »