How to Delete an Array Element in PHP ?
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...
- How To Use Php Conditional Statement Example
- How to Check if String Contains Regex in PHP?
- PHP Array_column() Function Example
- PHP Generate List of Random Numbers Between 0 and 100 Example
- How to User Login with Facebook in PHP?
- How to Explode Every Character into Array Using PHP Example?
- PHP Form Validation Tutorial
- PHP Convert XML to JSON Example