remove keys from array php

Posted by w3diy - 6 months ago

php array remove keys keep values example

$myArray = [
    'bhavik' => 'Bhavik',
    'ridhi' => 'Ridhi',
    'krishna' => 'Krishna',
    'dipti' => 'Dipti'
];

$reCreateArray = array_values($myArray);

print_r($reCreateArray);   

Results:

Array
(

    [0] => Bhavik
    [1] => Ridhi
    [2] => Krishna
    [3] => Dipti

)