Home>Article>Backend Development> How to remove null values from php array

How to remove null values from php array

L
L Original
2020-06-01 15:20:53 3117browse

How to remove null values ​​from php array

How to remove null values from php array

Function name: array_filter()

Calling method: array_filter(array) Parameter description: array) Parameter description: array is the object of the operation, we will delete the empty elements

Instance:

 "abc", 'b' => "bcd",'c' =>"cde",'d' =>"def",'e'=>""); $b= array_filter($array); print_r($b); ?>

Result:

Array ( [a] => abc [b] => bcd [c] => cde [d] => def )

Recommended tutorial: "PHP Tutorial"

The above is the detailed content of How to remove null values from php array. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn