How to delete all elements from array except the first element in PHP

1 Answer

0 votes
$arr = array("php", "c", "c++", "c#", "python", "java");

array_splice($arr, 1);

print_r($arr);




/*
run:

Array
(
    [0] => php
)

*/

 



answered Dec 8, 2020 by avibootz
...