Quickly Removing Empty Array Elements in PHP

Removing empty array slots in PHP, and compacting the array.

$myArray = array( 0, 'red', '', 'blue' );
$myArray = array_filter( $myArray );
print_r( array_slice( $myArray, 0 ) );
Array
(
  [0] => 'red'
  [1] => 'blue'
)