Remove Empty Value From Array | Web Programming Tutorial

Remove Empty Value From Array

Published Date: November 4, 2013 |
Published Time: 11:42 pm |

Removing empty, false, null value from an php array, is so simple and easy.But during many calculation we usually need to do calculation through array variable and remove the empty value.

PHP has a built in function to remove this empty value from array , where the index of the array doesn’t change.This is array_filter() function.

An Example:

Output will like that:

Array ( [0] => Mango [1] => Orange [2] => Apple [4] => Banana )

Very Easy and simple but Useful :)

Leave a Reply

Your email address will not be published. Required fields are marked *