note 97918 added to language.oop5.overloading
| From: | navarr at gtaero dot net | Date: | Sat, 15 May 2010 20:25:47 +0000 |
| Subject: | note 97918 added to language.oop5.overloading | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169292@lists.php.net to get a copy of this message | ||
If you want to make it work more naturally for arrays $obj->variable[] etc you'll need to
return __get by reference.
<?php
class Variables
{
public function __construct()
{
if(session_id() === "")
{
session_start();
}
}
public function __set($name,$value)
{
$_SESSION["Variables"][$name] = $value;
}
public function &__get($name)
{
return $_SESSION["Variables"][$name];
}
public function __isset($name)
{
return isset($_SESSION["Variables"][$name]);
}
}
----
Server IP: 69.147.83.197
Probable Submitter: 99.64.59.29
----
Manual Page -- http://www.php.net/manual/en/language.oop5.overloading.php
Edit -- https://master.php.net/note/edit/97918
Del: integrated -- https://master.php.net/note/delete/97918/integrated
Del: useless -- https://master.php.net/note/delete/97918/useless
Del: bad code -- https://master.php.net/note/delete/97918/bad+code
Del: spam -- https://master.php.net/note/delete/97918/spam
Del: non-english -- https://master.php.net/note/delete/97918/non-english
Del: in docs -- https://master.php.net/note/delete/97918/in+docs
Del: other reasons-- https://master.php.net/note/delete/97918
Reject -- https://master.php.net/note/reject/97918
Search -- https://master.php.net/manage/user-notes.php