是null等于''

I using this code

$dato = array_shift($datos);
while($dato!=''){...}

Is it correct?

Is the same to put:

while($dato!=''){...}

Than

while($dato!=null){...}

Edit: This is on the oficial documentation php

Returns the shifted value, or NULL if array is empty or is not an array.

But my code is actually running

I think you are trying to check the value is empty in any array

while(!empty($dato)){...}

NULL = Doesn't exist
'' = Exists but it's empty

You can validate in many ways :

  1. By using php variable handling function is_null(mixed $var)
  2. By using php variable handling function is set(mixed $var)
  3. By using php variable handling function empty(mixed $var)
  4. By using comparison operator ==, === or !=