|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-05-23 11:27 UTC] 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(). PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 18:00:02 2025 UTC |
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); // ?>