Connecting Tech Pros Worldwide Forums | Help | Site Map

Creative a regular array from associative array?

namemattersnot@msn.com
Guest
 
Posts: n/a
#1: Mar 8 '06
Re,

I have the following array:

$my_array[x]['date']
['time']
['filename']

how do I create a $time_array that will ONLY have all values of
$my_array[x]['time']? i can write a function to walk through the
associative array, but is there a more efficient method?

thanks!


Chris Hope
Guest
 
Posts: n/a
#2: Mar 8 '06

re: Creative a regular array from associative array?


namemattersnot@msn.com wrote:
[color=blue]
> Re,
>
> I have the following array:
>
> $my_array[x]['date']
> ['time']
> ['filename']
>
> how do I create a $time_array that will ONLY have all values of
> $my_array[x]['time']? i can write a function to walk through the
> associative array, but is there a more efficient method?[/color]

Would this do what you want?

$foo = $my_array[x]['time'];

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
namemattersnot@msn.com
Guest
 
Posts: n/a
#3: Mar 8 '06

re: Creative a regular array from associative array?


no, because I have over 500 entries and this would work with just 1
entry.

Chung Leong
Guest
 
Posts: n/a
#4: Mar 8 '06

re: Creative a regular array from associative array?



namemattersnot@msn.com wrote:[color=blue]
> Re,
>
> I have the following array:
>
> $my_array[x]['date']
> ['time']
> ['filename']
>
> how do I create a $time_array that will ONLY have all values of
> $my_array[x]['time']? i can write a function to walk through the
> associative array, but is there a more efficient method?[/color]

The answer is no.

Toby Inkster
Guest
 
Posts: n/a
#5: Mar 8 '06

re: Creative a regular array from associative array?


namemattersnot wrote:
[color=blue]
> i can write a function to walk through the associative array, but is
> there a more efficient method?[/color]

Just walk it.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Closed Thread