In PHP, is NULL a constant or a keyword?

Question:

In PHP, is NULL a constant or a keyword?

I've heard it's a constant, but it looks like the behavior of PHP keywords (case insensitive)?

Example:

echo NULL;

echo null;

exit('teste');

EXIT('teste');

Answer:

NULL is a type according to the Link documentation and is also the only possible value of the NULL type (confused but that's what it's in the documentation)

So from the documentation it can be seen that NULL is:

  • one kind.

    NULL is the only possible value of type NULL.

  • a constant.

    it has been assimilated with the constant NULL.

  • a value.

    NULL is the only possible value of type NULL.

Scroll to Top