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
https://forums.phpfreaks.com/topic/170040-finding-multidimensional-arrays/
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..

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.