tags:

views:

32

answers:

2

Hi,

I am trying to get the title name of an array object.

For example I have

$results[0]['page']
$results[0]['title']

I was wondering if I could use a for loop to loop through the $results[0] array and get the 'page' and 'title' names and insert them into a new array?

Thanks for your time

+3  A: 
foreach ($results[0] as $key=>$value) {
     //Your key will be page and title, and then the value will be in value
}

More information on the PHP documentation for foreach().

Brad
Thanks mate big help
+1  A: 

Or you could just use array_keys() to turn the assoc indexes into a new array automatically.

Jeff Standen
Thanks mate massive help!