keyongtech


  keyongtech > php > 03/2006

 #1  
03-08-06, 12:46 AM
namemattersnot
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!
 #2  
03-08-06, 01:17 AM
Chris Hope
namemattersnot wrote:

> 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?


Would this do what you want?

$foo = $my_array[x]['time'];
 #3  
03-08-06, 01:33 AM
namemattersnot
no, because I have over 500 entries and this would work with just 1
entry.
 #4  
03-08-06, 02:26 AM
Chung Leong
namemattersnot wrote:
> 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?


The answer is no.
 #5  
03-08-06, 08:44 AM
Toby Inkster
namemattersnot wrote:

> i can write a function to walk through the associative array, but is
> there a more efficient method?


Just walk it.
Similar Threads
Regular Expression Result as Associative Array Index

Hi Everyone. $layout=ereg_replace("\[\[([a-z:0-9]+)\]\]", $dillo['\\1'], $layout); I'm trying to use the result of a Regular Expression Match as an Index for the...

convert associative array to ordinary array

Hi, i have an associative array and i want to use it as an ordinary array, is that possible? what i mean is instead of $arr['fruit'] i want to call it by its position in...

Array and Hash (Associative array) in JavaScript v.3.0

Whatever you wanted to know about it but always were affraid to ask. <http://www.geocities.com/schools_ring/ArrayAndHash.html>

<FAQENTRY> Array and hash (associative array)

Or why I just did myArray['item01'] = "Computers" but myArray.length is showing 0. What a hey? There is a new trend to treat arrays and hashes as they were some variations...

[newbie]saving and reading array of associative array

i'm looking for examples of saving to file and reading back an array of associative array, in a ruby like way. saying i have something like : one = {"Name" => "Smith",...


All times are GMT. The time now is 02:39 AM. | Privacy Policy