How to Remove Numeric Values in PHP Array?
Hello Guys,
This simple article demonstrates of php array remove numeric values. We will use how to remove numeric values in array php. Here you will learn how to remove numeric values in php array. This post will give you a simple example of how to delete number from array in php.
we will use array_filter() function to remove numeric values from php array. so, let's see the simple code of how to delete numeric values from php array.
Example:
index.php
<?php
$myArray = [1, "Two", 3, "Four", 5, "Six"];
$newArray = array_filter($myArray, 'is_string');
var_dump($newArray);
?>
Output:
array(3) {
[1]=> string(3) "Two"
[3]=> string(4) "Four"
[5]=> string(3) "Six"
}
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to Get First 3 Elements of Array in PHP?
- How to Get Last 5 Elements of Array in PHP?
- How to Get Last 2 Elements of Array in PHP?
- How to Remove Duplicate Values from Array in PHP?
- How to Set Value as Key in PHP Array?
- How to Convert Array Key to Lowercase in PHP?
- How to Remove Specific Element by Value from Array in PHP?
- How to Remove undefined Value from Array in JQuery?
- How to Get Maximum Key Value of Array in PHP?
- How to Remove Empty Values from Array in PHP?
- How to Add Prefix in Each Key of PHP Array?
- How to Get Minimum Key Value of Array in PHP?
- How to Remove Null Values from Array in PHP?