note 118233 added to keyword.extends
| From: | vittorio dot zamparella at gmail dot com | Date: | Fri, 30 Oct 2015 16:58:40 +0000 |
| Subject: | note 118233 added to keyword.extends | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204057@lists.php.net to get a copy of this message | ||
extending a PHP class with an included file "delays" the compilation:
<?php
require 'MySuperclass.php';
var_dump(class_exists('MyFirstClass')); // FALSE
class MyFirstClass extends MySuperclass {}
// the "compilation" of this is delayed till execution
var_dump(class_exists('MyFirstClass')); // TRUE
class AnotherSuperclass { /* nothing */}
var_dump(class_exists('MySecondClass'));
// returns TRUE even if it's called "before" definition
class MySecondClass extends AnotherSuperclass {}
?>
see also the examples at http://php.net/manual/en/function.class-exists.php
discoverd this when autoinitializing some static classes
----
Server IP: 72.52.91.14
Probable Submitter: 93.50.125.138
----
Manual Page -- http://php.net/manual/en/keyword.extends.php
Edit -- https://master.php.net/note/edit/118233
Del: integrated -- https://master.php.net/note/delete/118233/integrated
Del: useless -- https://master.php.net/note/delete/118233/useless
Del: bad code -- https://master.php.net/note/delete/118233/bad+code
Del: spam -- https://master.php.net/note/delete/118233/spam
Del: non-english -- https://master.php.net/note/delete/118233/non-english
Del: in docs -- https://master.php.net/note/delete/118233/in+docs
Del: other reasons-- https://master.php.net/note/delete/118233
Reject -- https://master.php.net/note/reject/118233
Search -- https://master.php.net/manage/user-notes.php