![]() |
Problem with array php
Hey guys im having an issue trying to iterate into an array. This is the array:
stdClass Object ( [new_occ] => Array ( [0] => Array ( [adults] => 2 [children] => Array ( [0] => 0 [1] => 0 [2] => 0 ) ) [1] => Array ( [adults] => 1 ) [2] => Array ( [adults] => 2 [children] => Array ( [0] => 0 [1] => 0 [2] => 0 ) ) ) ) The principal array nodes are rooms, i want to get them so i can print something like this. (e.g) Rooms Adults Children 1 1 1 2 2 2 Thanks in advance. ___________________________________________ Wholesale Handbags |
Quote:
You need foreach, but you have nested arrays so will go like this: Code:
$my_array = new_occ;If $vv displays as "Array" then you need an additional nested foreach. If all displays OK, then put the logic to work that you need, instead of the "echo" statement. If you need to track original key use this: Code:
$my_array = new_occ;Cheers! OMR |
| All times are GMT. The time now is 08:36 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0