php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #41472 overload() incomplete Ddocumentation
Submitted: 2007-05-23 11:27 UTC Modified: 2007-05-23 12:18 UTC
From: uli at combie dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: all
Private report: No CVE-ID: None
 [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().


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-23 12:18 UTC] bjori@php.net
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); //

?> 

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 21:01:33 2025 UTC