Linked Questions
136 questions linked to/from Transposing multidimensional arrays in PHP
0 votes
3 answers
108 views
Merge values from different arrays to one with the same key [duplicate]
I have two arrays: Array ( [0] => 5 [1] => 4 ) Array ( [0] => BMW [1] => Ferrari ) And I would like to have that result. Merge the values with the same key Array ( ...
-1 votes
2 answers
230 views
php how can I merge two arrays? [duplicate]
i am trying to merge two similar arrays with the same keys Array ( [0] => 4064628 [1] => 4064953 [2] => 4064922 [3] => 4064870 [4] => 4064789 [5] => 4064631 ...
0 votes
4 answers
87 views
How to convert a multi array in two arrays in php [duplicate]
How to convert a multidimensional array in two arrays in php This array: Array ( [name] => Array ( [0] => Lighthouse.jpg [1] => Penguins.jpg ) ...
1 vote
7 answers
110 views
PHP: Take several arrays, and make new ones based on shared indexes? [duplicate]
So, imagine you have 3 arrays: 1,2,3,4,5 6,7,8,9,10 11,12,13,14,15 And you want to combine them into new arrays based on index: 1,6,11 2,7,12 3,8,13 4,9,14 5,10,15 What on earth could achieve this? ...
0 votes
3 answers
101 views
Transpose an indexed array of associative arrays [duplicate]
I have an array of date like this Array ( [0] => Array ( [imageName] => WNgrRdqZ [alt] => alt text ) [1] => Array ( [...
0 votes
3 answers
92 views
Transpose a SimpleXMLElement object containing arrays [duplicate]
I have this array: SimpleXMLElement Object ( [id] => Array ( [0] => Koala.jpg [1] => Jellyfish.jpg ) [desc] => Array ( [0] => koaladesc [1] =...
1 vote
1 answer
50 views
PHP looping array to get combined rows of items [duplicate]
I need to turn this array: $data = array(array('a', 'b'), array('1','2'), array('hi','bye')); Into this one: $final = array (array ('a', '1', 'hi'), array ('b','2','bye')); How do I loop $data to ...
3 votes
2 answers
100 views
How to arrange a multidimensional array in a certain format? [duplicate]
I have a array in below format Array ( [title] => Array ( [0] => Ram [1] => ramesh [2] => john [3] => mahesh ) ...
-1 votes
4 answers
57 views
Merging two simple arrays into a multidimensional array [duplicate]
I'm trying to merge two arrays together, however I can't figure out how. 1st Array: Array ( [0] => a [1] => b [2] => c ) 2nd Array: Array ( [0] => 1 [1] => 1 ) ...
0 votes
2 answers
75 views
How to transpose an associative array of indexed arrays? [duplicate]
I've array like this in php: Array ( [Color] => Array ( [0] => Pink [1] => Pink [2] => Pink [3] => Pink ) [Size] ...
0 votes
2 answers
94 views
Transpose data in an associative array of indexed arrays [duplicate]
I'm not sure how to search for the problem I'm facing, so that's why I'm asking here. I want to know if there is a native php-function to transform following array I get from a html-form: Original ...
1 vote
3 answers
71 views
Transpose associative array of indexed arrays to be indexed array of associative arrays [duplicate]
I need to convert a PHP array that I'm getting from a form submission, so that I can use it more usefully in a db. Array ( [first_name] => Array ( [0] => Ben [1] => Tom ...
0 votes
3 answers
68 views
PHP: Packing different array values [duplicate]
$_POST is equal to: Array ( [time_start] => Array ( [0] => 00:00 [1] => 02:00 ) [time_end] => Array ( [0] => 03:00 ...
-1 votes
2 answers
230 views
Convert nested associative array to single array in php [duplicate]
I have nested array with key & value pair. i want to convert it in single array. /* This is current array */ Array ( [id] => Array ( [0] => 1 [1] => 2 ...
0 votes
4 answers
157 views
Display transposed data as html table [duplicate]
I have this array: Array ( [Saturday] => Array ( [11:00am] => 0 [12:00pm] => 0 [1:00pm] => 0 [2:00pm] => 0 [3:...