Home>Article>Backend Development> 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!