Yana  Kutsenko
0
Q:

php check for null

// The is_null() function checks whether a variable is NULL or not. This function returns true (1) if the variable is NULL, otherwise it returns false/nothing.

<?php
    $var = NULL;  
	if (is_null($var)) {
      	echo "yes, is null";
      
    } else {
      	echo "not null";
    }
?>
  
1
<?php
  
	$var = NULL;  

?>
2
is_null (var_name)
0
is_null($var)
0

New to Communities?

Join the community