php flatten array

Solutions on MaxInterview for php flatten array by the best coders in the world

showing results for - "php flatten array"
Leonardo
29 Mar 2016
1<?php
2
3$notFlat = [[1,2],[3,4]];
4$flat = array_merge(...$notFlat);
5var_dump($flat);
6
Emery
04 Aug 2017
1$c = ["a" => ["x" => "X", "y" => "Y"], "b" => ["p" => "P", "q" => "Q"]];
2print_r(array_merge(...array_values($c)));
3
4Array
5(
6    [x] => X
7    [y] => Y
8    [p] => P
9    [q] => Q
10)
11
Amélie
04 Mar 2018
1array_merge(...$a);
2
Hector
24 Feb 2016
1$a = [[10, 20], [30, 40]];
2$b = [["x" => "X", "y" => "Y"], ["p" => "P", "q" => "Q"]];
3
4print_r(array_merge(...$a));
5print_r(array_merge(...$b));
6
7Array
8(
9    [0] => 10
10    [1] => 20
11    [2] => 30
12    [3] => 40
13)
14Array
15(
16    [x] => X
17    [y] => Y
18    [p] => P
19    [q] => Q
20)
21
queries leading to this page
flat php array flatten 2 dimensional array phpphp flatten array one levelreduce multi dimension array to oneflatten array php 8php squash array similar itemsarray flatten with valueswhat is flatten array in phpflatten function in phpflatten array within array phpphp flatten multidimensional associative arrayhow to flatten multidimensional array in phpflatten multidimensional array phparray flat phpflatten nnested array phpflatten phpmultivalue array to single value phpflat to array values phpflat in phparr 3a 3aflatten phpphp flat two dimensional arrayphp array multidimensional flattenflatten php arrayarray 28 array 5b0 5d 28 flatten phpphp plain arrayphp array flatphp flatten an arrayphp flattentflatten function phpphp flatten arraayget all values of array inside array phpphp flatten array keyflaten array php withoutphp flatten two dimensional arrayphp make array values to flatflat an array phphow to flat arrayy php2 dimensional array in flatten phpphp flat 2d arrayphp array flatten php 5 2array flatten php definephp flatten array with keysphp array collapsephp flatten array to to array with keysget all values of individual array phpphp flaten arraywhat is array flatten 28 29 phpphp array flatten arrayarray flatten php laravelphp 7 2a array flattenarray flatten phpflat single array phpflatten array 2d phparray flatten phpflatten array one level phpphp get values from arrayflatten array of arrays phpphp flattern arrayarray flater phpflatten array 28 29 phpflatern array of array phpflatten array in phphow to flat an array phphow to use flatten in phpphp flat arraflatten multidimensional array php 7php array flat valuephp flatten the arrayhow to flatten array of object phparray flatten phparray flat in phpflatt array phpflatten arrays in phpflatten arrat phpflatten array phpphp flatten arrayremove index and make arary flat in phpflatten mulltidimensional array phphow to flatten an array in phphow to flatten a multidimensional array phpflat multidimensional array phpphp array flatten one levelget array of values phpphp function array flatphp multidimensional array to flatflatten array top level phpworking with flatted arrays phpflatten multidimensional arrayflatten array 1 level up 2b phpflaten array phpflatten array php array 28 5b0 5d 3d 3ephp array flat associative arraylaravel flatten multidimensional associative arrayhow to save ids in array with index in phpphp flat multidimensional arrayphp 8 array flattenget id only from array phpphp array in array get valuephp flatarray to flat list phpphp array flatten associativephp 7 array flattenarray flatten in phpflatten a multidimensional array phpflatten inner arrays phpflattern array phpphp array flatternhow to flatten array phpphp unwrap multidimensional arrayphp flatter arrayflat associative array phpphp flatten array of arraysphp get specific value from arrayarray flattern phpphp multidimensional array flattenarray flat phpphp array flatphp array flatten 2020php flatten multidimensional arrayflat 28 29 phpphp access array flatphp 7 4 array flattenflat array phpphp array get only idsphp flat 2 dimensional arrayphp flat array to multidimensionalphp flattenif array level 1 flatten phpget specific value from array of array in phpget array value by key phparray flatter phpflatten nested arrays phpphp flat arrayarray flaten phpphp flatten multidimensional array with keysphp array flattenconvert nested array to flat array phpflat array in phpflattern arrays phpphp array flattenphp create multidimensional array from flat arrayflatten a php arrayphp flatten array