How to Delete an Array Element in PHP ?

Admin   PHP   92  2021-03-18 05:30:05

Hello Friends,

In this blog, I will show you unset method in php. We will talk about php unset array example. This article will give how to delete an array element in php. We will show deleting an element from an array in php. I am going to learn you how to remove specific element from an array in php.

Here i will full example for php unset method so let's see the bellow example:

Example

 

<?php

$lang = array("laravel", "php", "jquery", "nodejs", "boostrap");

unset($lang[0]);

while (list ($key,$val) = each ($lang)){

echo "$key -> $val <br>";

}

?>

Output:

 

0 -> laravel

1 -> php

3 -> nodejs

4 -> boostrap

It will help you...