NULL is a data type and is not a scalar

While NULL is listed as a data type the consequences of this is not triivial. Most importantly, this is the reason why it is not considered a scalar. is_scalar($variable) is a shorthand for is_bool($variable) || is_string($variable) || is_int($variable) || is_float($variable) and NULL is none of those. It "feels" like NULL should be a scalar -- Wikipedia says "In computing, a scalar is any non-composite value". This is just one of these decisions PHP made (and I am not sure this was a conscious decision by anyone, it might have been a simple oversight of not adding is_null to the above) and you need to memorize: NULL is not a scalar.

Comments

what about

what about || $variable === NULL

wouldnt that work?

Sure

It works but you need to know that you need it.

Null means the absence of

Null means the absence of value, therefore it is neither a composite nor non-composite value. This seems fine to me.