is this the right syntax to check if a value is equivalent to NULL or not in PHP:
if($AppointmentNo==NULL)
? I have tried it but it seems that it is not working. Any suggestion for another syntax?
Thanks
is this the right syntax to check if a value is equivalent to NULL or not in PHP:
if($AppointmentNo==NULL)
? I have tried it but it seems that it is not working. Any suggestion for another syntax?
Thanks
Use is_null()
:
if(is_null($AppointmentNo)) {
// do stuff
}
Alternatively, you could also use strict comparison (===
):
if($AppointmentNo === NULL) {
An example:
$foo = NULL;
if(is_null($foo)) {
echo 'NULL';
} else {
echo 'NOT NULL';
}
Output:
NULL