note 60703 added to language.oop5.overloading
| From: | namik at flashmail dot com | Date: | Sat, 14 Jan 2006 16:42:06 +0000 |
| Subject: | note 60703 added to language.oop5.overloading | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-101751@lists.php.net to get a copy of this message | ||
Upon uploading some code from my PHP 5.1.2 test server, I found some troubles running it on my
host's PHP 5.0.5.
__get() can not be private and you can not expect already existing variables to get passed to
__get().
<?php
Kernel = class
{
private static $smarty;
function __construct() { . . . }
function __get($name)
{
if ($name == "smarty") $result = $smarty;
return $result;
}
}
$kernel = new Kernel;
echo $kernel.smarty;
?>
PHP 5.0.5: $smarty is private
PHP 5.1.2: Object id #2
Also, in the documentation above __get is private. This does not work in 5.0.5 but does in 5.1.2
----
Manual Page -- http://www.php.net/manual/en/language.oop5.overloading.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60703
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60703&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60703&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60703&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60703&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60703&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60703&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60703&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60703&report=yes
Search -- http://master.php.net/manage/user-notes.php