Home>

method one:

$a=array ("fruits" =>array ("a" =>"orange",  "b" =>"grape", c =>"apple"),  "numbers" =>array (1,2,3,4,5,6),  "holes" =>array ("first", 5 =>"second", "third")
  );
foreach ($a as $list =>$things) {
 if (is_array ($things)) {
  foreach ($things as $newlist =>$counter) {
   echo "key:". $newlist. "<br />". "value:". $counter. "<br />";
  }
 }
}

Method Two:

function mulitarraytosingle ($array) {
  $temp=array ();
  if (is_array ($array)) {
   foreach ($array as $key =>$value)
   {
    if (is_array ($value)) {
     mulitarraytosingle ($value);
    }
    else {
     $temp []=$value;
    }
   }
  }
}
php
  • Previous Use UIScrollView to implement image carousel and click loading in iOS development
  • Next Implementation method of dynamically creating form and submitting in JavaScript