How about using array_count _values to get an array with everything counted for you?
Just an idea, you could use array_keys( $myArray, "" ) using the optional second parameter which specifies a search-value. Then count the result.
array_keys( $myArray, "" )
$myArray = array( "","","other","","other" );$length = count( array_keys( $myArray, "" ));
I dont know if this would be faster but it's something to try:
$counter = 0;foreach($array as $value){ if($value === '') $counter++;}echo $counter;