I'm having an array key-value pair. I need to create new array from this key and value pair. for eg
I tried with foreach loop
foreach($array as $key => $val){
// here i m getting key and value i want to combine key and value in single array
}
Array
(
'146' => Array
(
'sam' => Array (
'dex',
'max'
)
)
'143' => Array
(
'tim' => Array (
'thai',
'josh'
)
)
)
and the expected output is push key as first element
$out = [
[ 'sam', 'dex', 'max'],
[ 'tim','thai', 'josh']
];