#41472 [Opn->Bgs]: overload() incomplete Ddocumentation
| From: | bjori@php.net | Date: | Wed, 23 May 2007 12:18:12 +0000 |
| Subject: | #41472 [Opn->Bgs]: overload() incomplete Ddocumentation | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969376406@lists.php.net to get a copy of this message | ||
ID: 41472
Updated by: bjori@php.net
Reported By: uli at combie dot de
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: all
PHP Version: Irrelevant
New Comment:
No.
You have to enable the overload extension (it is enabled by default
though).
You are probably confusing overloaded properties with public
properties.
<?php
class obj {
var $overloaded = array("name" => "My name");
function __get($prop, &$retval) {
if(isset($this->overloaded[$prop])) {
$retval = $this->overloaded[$prop];
return true;
}
return false;
}
}
$obj = new obj;
/* This will print NULL since there is no "name" property */
var_dump($obj->name);
overload("obj");
$obj = new obj;
/* This will however print "My name" */
var_dump($obj->name); //
?>
Previous Comments:
------------------------------------------------------------------------
[2007-05-23 11:27:25] uli at combie dot de
Description:
------------
This concerns the documentation too overload() and the PHP4 object
syntax. Since PHP4.4.? there no function overload(). In this version:
__call(), __set() and __get() are full compatible to PHP5. There is no
need to call overload().
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41472&edit=1