Jump to content

finding multidimensional arrays


purencool

Recommended Posts

I have a multidimensional array that I don't know the contents of. How do I do a search to find how many arrays and what are their names?

 

an example this is the print_r of the are I want to be able to automate the search of our partners.

# Array ( [0] => About_Us.php
# [1] => Contact_Us.php
# [2] => Energy_Management.php
# [3] => Environment.php
# [4] => Home.php
# [Our_Partners] => Array ( [0] => Ecobulb.php
# [1] => Globpros.php
# [2] => Powersave.php
# [3] => Utiligy.php
# ) [Our_Services] => Array ( [0] => 5_Step_Process.php
# [1] => Electricity.php
# [2] => Gas_and_Water.php
# [3] => Light.php
) ) 


 

Link to comment
Share on other sites

I believe you can just use the 'each()' command, such as this:

reset($array);
while (list($key, $val) = each($array)) {
    echo "$key => $val\n"; //Write search code here
}

And it should list everything in the array even if unknown, then you can write a search function inside..

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.