0
How to convert multidimensional associative array to indexed array?
I have a multidimensional array like this $arr=array( "Student1"=>array("name"=>"jon","age"=>"33","marks"="44"), "Student2"=> array("name"=>"jonas","age"=>"23","marks"="64"), "Student3"=> array("name"=>"kim","age"=>"35","marks"="74") ); I need output as:- Array(name=>jon, Age=>33, Marks=>44 , name=>jonas, Age=>23, Marks=>64, name=>kim, Age=>35, Marks=>75
2 Réponses
+ 1
https://stackoverflow.com/questions/45999272/how-to-convert-php-multi-dimensional-associative-array-to-simpler-indexed-array
https://stackoverflow.com/questions/42510211/convert-multi-dimensional-associated-array-to-be-indexed-array
https://www.daniweb.com/programming/web-development/threads/448110/convert-associative-array-to-indexed-array
https://www.programmersought.com/article/94683221234/
+ 1
PHP does not distingish between indexed and associative array. And you cannot use the same key to store another value without overwriting the previous value.
You can make a new array without using "Student#" as keys, but integer indice will be used in their places.
Is one of these outputs acceptable?
https://code.sololearn.com/wKu3x779U07l/?ref=app