note 120938 added to function.defined
| From: | DawidKrysiak | Date: | Wed, 05 Apr 2017 11:10:00 +0000 |
| Subject: | note 120938 added to function.defined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-208977@lists.php.net to get a copy of this message | ||
It may be obvious (but I haven't found it written literally nowhere), that checking if the
class constant is defined using defined() function, tries to autoload the class in which the
constant is defined (if the class is not already loaded). At least in my php 5.5.9.
<?php
if (defined('vendor\\package\\SomeClass::MAJOR')) { // autoloading here
echo 'Oh, I know how to recognize major stuff!'. PHP_EOL;
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 213.155.166.101
----
Manual Page -- http://php.net/manual/en/function.defined.php
Edit -- https://master.php.net/note/edit/120938
Del: integrated -- https://master.php.net/note/delete/120938/integrated
Del: useless -- https://master.php.net/note/delete/120938/useless
Del: bad code -- https://master.php.net/note/delete/120938/bad+code
Del: spam -- https://master.php.net/note/delete/120938/spam
Del: non-english -- https://master.php.net/note/delete/120938/non-english
Del: in docs -- https://master.php.net/note/delete/120938/in+docs
Del: other reasons-- https://master.php.net/note/delete/120938
Reject -- https://master.php.net/note/reject/120938
Search -- https://master.php.net/manage/user-notes.php