Reply to Forech question (Sorry if duplicate)

Your name:

Reply:


Posted by Lorenzo Thurman on 05/11/07 21:38

I'm passing an array which contains 2 arrays as subarrays to a function
that uses foreach to iterate through each sub-array. Each subarray has
exactly 7 items.
function listitems($anArray){

// $anArray is 2-dim array
foreach($anArray as $item=>$arr){
var_dump($arr);

}

array(2) {
[0]=>
array(1) {
["X"]=>
string(4) "this"
}
[1]=>
array(1){
["y"]=>
string(3) "xyz"
}
Instead the items show up as scalars. Like this:
string[5]='string'
string[3]='xyz'

In short, I would expect the foreach to create an array containing 1
item from subarray[0] and subarray[1] and display it as such. So clearly
I don't understand something, but how do I reference each item?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация