A colleague of mine discovered, by ctrl-clicking on null
in PHPStorm, that PHP defines null
as
define ('null', null, true);
in core_d.php
.
null
as itself?My best theory so far is that perhaps null
is defined already, but using define
allows adding a case-insensitive alias, so to speak. I don't know enough about PHP to judge the likelihood of this.
core_d.php
belongs to PHPStorm not PHP itself. See the file on github. PHP is written almost entirely in C. The file probably exists to help with code insights and static analysis. From the README file of the stubs repo:
STUBS are normal, syntactically correct PHP files that contain function & class signatures, constant definitions, etc. for all built-in PHP stuff and most standard extensions. Stubs need to include complete PHPDOC, especially proper @return annotations.
An IDE needs them for completion, code inspection, type inference, doc popups, etc. Quality of most of these services depend on the quality of the stubs (basically their PHPDOC @annotations).
However, as pointed out by Bartosz Zasada php does define a constant called null. It is currently defined in line 137 of ext/zend/zend_constants.c
in the php source code at the end of zend_register_standard_constants()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With