i have an array like: Array ( [ResultSet] => Array ( [Result] => Array ( [0] => yahoo china [1] => china airlines [2] => china map [3] => air china [4] => china mobile tv phone [5] => china news [6] => china travel [7] => china population [8] => bank of china [9] => china southern airlines ) ) ) Code (markup): I would like to get the length of the array, as you know, the length maybe 10, maybe 40. and i want to get the items from the array, such as $result[0], i know this is not right, but i do not know how to write. please help. thanks
get the length with: $length = count($array['ResultSet']['Result']); Access with: $array['ResultSet']['Result'][0]
i should add some details to this one. $obj=Array ( [ResultSet] => Array ( [Result] => Array ( [0] => yahoo china [1] => china airlines [2] => china map [3] => air china [4] => china mobile tv phone [5] => china news [6] => china travel [7] => china population [8] => bank of china [9] => china southern airlines ) ) ) do i need to add $obj to somewhere?
Just change $array to $obj get the length with: $length = count($obj['ResultSet']['Result']); Access with: $obj['ResultSet']['Result'][0]