So i got one single dimensional array like:
Array
(
[0] => md5
[1] => name
[2] => description
[3] => url
)
and one multidimensional array:
Array
(
[0] => Array
(
[0] => md5#1
[1] => name1
[2] => desc1
[3] => url1
)
[1] => Array
(
[0] => md5#2
[1] => name2
[2] => desc2
[3] => url2
)
)
and I want to use values of first array as keys for subarrays of the multidimensional one, so the output should look like:
Array
(
[0] => Array
(
[md5] => md5#1
[name] => name1
[desription] => desc1
[url] => url1
)
[1] => Array
(
[md5] => md5#2
[name] => name2
[description] => desc2
[url] => url2
)
)
Alternatively(as a bit offtopic question), how can I sort the elements of multidimensional array by values of md5 if they keys of subarray are not [md5] but [0]?
Thanks in advance!
array_combine. Sorting is done withusort.array_combine($keysarray, $multiDarray)I getarray_combine(): Both parameters should have an equal number of elementsbecause i think it's trying to set the keys for the [0] => Array, and not for it;s elements.