note 70880 added to function.runkit-import
| From: | php at ransico dot com | Date: | Thu, 02 Nov 2006 13:17:47 +0000 |
| Subject: | note 70880 added to function.runkit-import | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119313@lists.php.net to get a copy of this message | ||
When using this function to override an existing class, you need to be careful in cases where the
new definition 'extends' another class - it won't work.
For example,
<?php
// File 1
class BaseCls { }
class TestCls extends BaseCls {
function hi () { echo "Hi"; }
}
runkit_import('test2.php');
?>
<?php
// File 2
class TestCls extends BaseCls {
function hi () { echo "Hi again!"; }
}
?>
will NOT work. In file two, you need to omit the 'extends BaseCls'. Note however, that
anything from BaseCls will still be in TestCls since it was defined originally in file 1.
From what I can tell, runkit_import defines and overwrites elements - however it does not delete.
----
Server IP: 203.16.234.90
Probable Submitter: 125.62.78.182
----
Manual Page -- http://www.php.net/manual/en/function.runkit-import.php
Edit -- https://master.php.net/note/edit/70880
Del: integrated -- https://master.php.net/note/delete/70880/integrated
Del: useless -- https://master.php.net/note/delete/70880/useless
Del: bad code -- https://master.php.net/note/delete/70880/bad+code
Del: spam -- https://master.php.net/note/delete/70880/spam
Del: non-english -- https://master.php.net/note/delete/70880/non-english
Del: in docs -- https://master.php.net/note/delete/70880/in+docs
Del: other reasons-- https://master.php.net/note/delete/70880
Reject -- https://master.php.net/note/reject/70880
Search -- https://master.php.net/manage/user-notes.php