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

From: Date: Thu, 06 Mar 2003 02:35:51 +0000
Subject: Re: print "$array[$i][0]" pukes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-138403@lists.php.net to get a copy of this message
On Wed, 5 Mar 2003, David T-G wrote: > $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? Actually, it's literally printing "[0]" after it prints "Array". PHP is detecting that $manilist (not $manilist[0]) is an array (for which it prints "Array"), then you get a literal "[0]" afterwards because you put it all within quotes. If you print this way, you'll get what you want: print "$i :: " . $manilist[$i][0] . "\n"; HTH, ~Chris

« previous php.general (#138403) next »