php get array values by removing null / empty values

by Ramya 2014-01-08 19:29:42

php get array values by removing null/empty values:

for eg,

if you are having array as,
array([0]=>'asd',[1]=>'',[2]=>'sd')

and you wish to report only arrays without null/empty values, then use the following steps,

first, filter the array as,
$val = array_filter($arr);
display the array values as,
$finalVal = array_values(val);


while printing the final array, you will get,
[0] => 'asd'
[1] => 'sd'
1409
like
0
dislike
0
mail
flag

You must LOGIN to add comments