working array_length function