0

I want to flatten a multidimensional array by recursion. My array looks like

$arr_pages = array(
        "index" => array(
                "contenttitle" => "Home",

        ),
        "credentials"                => array(
                "contenttitle" => "Credentials...have a look",
                "sub"          => array(

                    // Second Level
                    "customer"  => array(
                            "contenttitle" => "Customer Projects",
                            "sub" => array(  

                                   "ABC" => array(
                                   "contenttitle" => "ABC Customer",
                            ),
                    ),
           ),

  );

I want to keep the data but changig the structure to

       "index" => array(
                "contenttitle" => "Home",

        ),
        "credentials" => array(
                "contenttitle" => "Credentials...have a look",


        "customer"  => array(
                "contenttitle" => "Customer Projects",
        )
        "ABC" => array(
             "contenttitle" => "ABC Customer",
         ),

So what is the best practice to create a new array with the new structure?

MichaelL
  • 11
  • 3

0 Answers0