note 113411 added to function.autoload
| From: | NanheKumar | Date: | Tue, 08 Oct 2013 10:06:33 +0000 |
| Subject: | note 113411 added to function.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-196493@lists.php.net to get a copy of this message | ||
Suppose you are creating an application and you are not clear about class properties then you can
use something like this
<?php
class Application{
private $data = array();
public function __get($name)
{
if (array_key_exists($name, $this->data)) {
return $this->data[$name];
}
$trace = debug_backtrace();
trigger_error( 'Undefined property via __get(): ' . $name . ' in ' .
$trace[0]['file'] .' on line ' . $trace[0]['line'], E_USER_NOTICE);
return null;
}
public function __set($name, $value)
{
$this->data[$name] = $value;
}
public function __isset($name)
{
return isset($this->data[$name]);
}
public function __unset($name)
{
unset($this->data[$name]);
}
}
?>
----
Server IP: 69.147.83.199
Probable Submitter: 210.7.74.130
----
Manual Page -- http://php.net/manual/en/function.autoload.php
Edit -- https://master.php.net/note/edit/113411
Del: integrated -- https://master.php.net/note/delete/113411/integrated
Del: useless -- https://master.php.net/note/delete/113411/useless
Del: bad code -- https://master.php.net/note/delete/113411/bad+code
Del: spam -- https://master.php.net/note/delete/113411/spam
Del: non-english -- https://master.php.net/note/delete/113411/non-english
Del: in docs -- https://master.php.net/note/delete/113411/in+docs
Del: other reasons-- https://master.php.net/note/delete/113411
Reject -- https://master.php.net/note/reject/113411
Search -- https://master.php.net/manage/user-notes.php