Posted by Arjun on Thursday 31st May 2012

How to remove all the empty elements of an array with php ?

This post is about removing empty elements from the given array using PHP. Here is example

$test_array = array('foo', 'bar', '', 'sleep', '',null,'arjun');
$test_array = array_filter($test_array);

Functions :

array_filter — Filters elements of an array using a callback function