note 8611 deleted from language.types.array by jimw
| From: | jimw@php.net | Date: | Fri, 14 Dec 2001 19:53:20 +0000 |
| Subject: | note 8611 deleted from language.types.array by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22669@lists.php.net to get a copy of this message | ||
[Editor's note: Slicing is akin to retrieving rows from a matrix, not columns from it. If you
need matrix code look for example at www.sourceforge.net/numphp]
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";
}