Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,039 questions

40,854 answers

573 users

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
...