Jump to content

[SOLVED] Retreive sub-arrays in a multidimensional array. Need help.


romain.pelissier

Recommended Posts

Hi,

I am stuck with what it seems to me a simple problem and I need some help. I am very new php programmer ... I am pretty sure that you experts can give me the answer in few words..

Here it is :

 

I have a multidimensional array that looks like this :

Array ( [2007] => Array ( [0] => Array ( [mois] => 7 [path] => /var/www/html/rapports/ARCHIVES/2007/7 ) [1] => Array ( [mois] => 6 [path] => /var/www/html/rapports/ARCHIVES/2007/6 ) ) [2006] => Array ( [0] => Array ( [mois] => 1 [path] => /var/www/html/rapports/ARCHIVES/2006/1 ) ) )

 

As you can see, the indexes are a number : 2007, 2006, ... and each item of those keys contains an array with other items like a path and a number :

2007
       0
           path : /var/www/html/rapports/ARCHIVES/2007/
           month : 7
       1
           path : /var/www/html/rapports/ARCHIVES/2007/
           month : 6
2006
       0
...

 

Now, if I know my index number (let say 2007) is there a way to retrieve the entire sub-array for that particular key so I can have in  a array the values for the key I have choosed ?

 

I hope you could answer me.

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.