Remove empty array elements - index value start from zero - PHP
by Francis[ Edit ] 2014-03-04 14:30:53
PHP Remove empty array elements - index value start from zero
If array having empty value, to trim the empty and rearrange the array index (from zero)
$ary = array("a","","b","c","","","","d");
$arr = array_values(array_filter($ary));
print($arr);
Output:
Array
(
[0] => "a";
[1] => "b";
[2] => "c";
[3] => "d";
)