Re: note 8611 added to Arrays

From: Date: Sat, 23 Sep 2000 00:21:34 +0000
Subject: Re: note 8611 added to Arrays
Groups: php.notes 
Request: Send a blank email to php-notes+get-5362@lists.php.net to get a copy of this message
Slicing is usually for row-retrieval, not for column retrieval (if we think of a 2D array as a matrix). See code elsewher for Matrix related classes/function (www.sourceforge.net/numphp). Note modified including this information. --- snoot@art-museum.org wrote: > It appears that multi-dimesional arrays cannot be > sliced vertically. > The following code does not work: > $test_array = array(0=>array('bar'=>'a', > 'baf'=>'aa','baz'=>'aaa'), > 1=>array('bar'=>'b', > 'baf'=>'bb','baz'=>'bbb'), > 2=>array('bar'=>'c', > 'baf'=>'cc','baz'=>'ccc')); > > $test_slice = $test_array['bar']; > echo "<h1>$test_slice</h1>\n"; > for > (reset($test_slice);$v=current($test_slice);next($test_slice)){ > echo "{$v[0]}<br>\n<br>\n"; > } > > http://www.php.net/manual/language.types.array.php > > > -- > PHP Notes Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > php-notes-unsubscribe@lists.php.net > For additional commands, e-mail: > php-notes-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > ===== --- Jesus M. Castagnetto (jcastagnetto@yahoo.com) __________________________________________________ Do You Yahoo!? Send instant messages & get email alerts with Yahoo! Messenger. http://im.yahoo.com/

« previous php.notes (#5362) next »