4
In PHP, NULL
is a constant or a keyword?
I’ve heard it’s a constant, but it looks like the keyword behavior of PHP
(that do not differentiate capital from minuscule)?
Example:
echo NULL;
echo null;
exit('teste');
EXIT('teste');
4
In PHP, NULL
is a constant or a keyword?
I’ve heard it’s a constant, but it looks like the keyword behavior of PHP
(that do not differentiate capital from minuscule)?
Example:
echo NULL;
echo null;
exit('teste');
EXIT('teste');
6
NULL
is a guy according to the documentation Link and is also the only possible value of the type NULL
(but that’s what’s in the documentation)
So from the documentation it can be verified that NULL is:
NULL is the only possible value of type NULL.
she was assimilated with the NULL constant.
NULL is the only possible value of type NULL.
2
Only by complementing the reply from @Ricardo:
Some represent things that look like functions, some seem constant but actually are not really: they are language constructors.
Examples of keywords:
Some that are also (but that actually look like functions)
To know all access to documentation.
-1
NULL in php is a type that represents the absence of value, in some languages it is represented by NIL!
Browser other questions tagged php null
You are not signed in. Login or sign up in order to post.
I know it may seem controversial some questions I ask, but do this test
var_dump(array_key_exists('NULL', get_defined_constants()))
. The result isTRUE
– Wallace Maxters
Just to relax
TRUE
andFALSE
are also constant, kkkkkkkk– Wallace Maxters
It’s not really very confusing and ambiguous
– Ricardo
NULL
is a constant with the valueNULL
who’s kindNULL
. :P– KaduAmaral
@Wallacemaxters very good example, this is very useful to get the result.
– Guilherme Nascimento
If you used the
isset
instead ofarray_key_exists
, would returnFALSE
, for theisset
checks if there is a variable and if it isNULL
. (I hope I don’t confuse anyone with this placement)– Wallace Maxters