I would like to replace some keys, my array is:
Array
(
[0] => Array
(
[0] => test1
[1] => test2
[2] => test3
[3] => test4
[4] => test5
[5] => test6
)
[1] => Array
(
[0] => test7
[1] => test8
[2] => test9
[3] => test10
[4] => test11
[5] => test12
)
)
My wish:
Array
(
[45] => Array
(
[0] => test1
[1] => test2
[2] => test3
[3] => test4
[4] => test5
[5] => test6
)
[51] => Array
(
[0] => test7
[1] => test8
[2] => test9
[3] => test10
[4] => test11
[5] => test12
)
)
45 and 51 are examples.
How can I do that? I tried array_flip() then array_search() but PHP says: "Can only flip STRING and INTEGER values!"
Thank's anyway. Regards
$old_array = array(
0 => array(0=>'test1',1=>'test2',2=>'test3',3=>'test4',4=>'test5',5=>'test6'),
1 => array(0=>'test1',1=>'test2',2=>'test3',3=>'test4',4=>'test5',5=>'test6')
);
$new_array = array(
45=>$old_array[0],
51=>$old_array[1]
);
var_dump($new_array);
0 comments:
Post a Comment