Comment se compliquer la vie inutilement plutôt.
array_filter($array) est suffisant, il suffit de lire le manuel :
array_filter($array)
If no callback is supplied, all entries of array equal to FALSE (see converting to boolean) will be removed.