Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

remove empty array elements php

$colors = array("red","","blue",NULL);

$colorsNoEmptyOrNull = array_filter($colors, function($v){ 
 return !is_null($v) && $v !== ''; 
});
//$colorsNoEmptyOrNull is now ["red","blue"]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #empty #array #elements #php
ADD COMMENT
Topic
Name
1+6 =