note 8611 added to Arrays

From: Date: Thu, 21 Sep 2000 03:04:07 +0000
Subject: note 8611 added to Arrays
Groups: php.notes 
Request: Send a blank email to php-notes+get-5251@lists.php.net to get a copy of this message
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

« previous php.notes (#5251) next »