Function : arrSort

This remove array keys with empty values and then returns a sorted array. Here, only empty strings and boolean value false are considered as empty values.

Syntax
  arrSort($array, $sort)
  
  $array: array to be sorted
  $sort : true sorts the array
   
                  
Sample 1
  vdump(arrSort([0 => 'foo', 1 => '', 2 => 'bar'])); //[0=>'foo', '2'=>'bar']
                  
Sample 2
  vdump(arrSort([0 => 'foo', 1 => '', 2 => 'bar'], true)); //[0=>'foo', '1'=>'bar']
                  
Sample 3
  vdump(arrSort([0 => 'foo', 1 => false])); //[0 => 'foo']
                  
Sample 4
  vdump(arrSort([0 => 0, 1 => 'bar'])); //[0=>0, '1'=>'bar']
                  
Sample 5
  vdump(arrSort([0 => [], 1 => 'bar'])); //[0=>[], '1'=>'bar']