I have var_dump() variable $fruit_array as below:
array (size=3)
0 =>
array (size=1)
'fruit_id' => string '2' (length=1)
1 =>
array (size=1)
'fruit_id' => string '1' (length=1)
2 =>
array (size=1)
'fruit_id' => string '3' (length=1)
I need to rename fruit_id
to id
and convert array string
value to integer
, example result:
array (size=3)
0 =>
array (size=1)
'id' => int 2
1 =>
array (size=1)
'id' => int 1
2 =>
array (size=1)
'id' => int 3
How can I do that ? thanks
You can do something like this: