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

From: Date: Thu, 06 Mar 2003 02:41:06 +0000
Subject: Re: print "$array[$i][0]" pukes
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-138404@lists.php.net to get a copy of this message
Chris -- ..and then Chris Wesley said... % % On Wed, 5 Mar 2003, David T-G wrote: % % > $m = count($manilist) ; % > for ( $i=0 ; $i<$m ; $i++ ) % > { print "$i :: $manilist[$i][0]\n" ; } .. % % Actually, it's literally printing "[0]" after it prints "Array". PHP is Right. % 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. Ahhhh... % % If you print this way, you'll get what you want: % % print "$i :: " . $manilist[$i][0] . "\n"; OK. That works, though it isn't pretty. Is there any way I can avoid doing the dot dance? I'd rather something like print "$i :: ${manilist[$i]}[0]\n" ; (which I know to not work! :-) than to have to open and close; that's just not very clean to me. I'm the sort who doesn't switch in and out of php parsing, either :-) % % HTH, % ~Chris Thanks & 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 (#138404) next »