Last active
August 29, 2015 13:59
-
-
Save cockok/10713963 to your computer and use it in GitHub Desktop.
Indirect modification of overloaded property Hoge::$hage has no effect in ...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Hoge { | |
private $data = array(); | |
public function __get($key) { | |
return array_key_exists($key, $this->data) ? $this->data[$key] : null; | |
} | |
public function __set($key, $value) { | |
return $this->data[$key] = $value; | |
} | |
} | |
$hoge = new Hoge(); | |
$hoge->hage = array(1); | |
$hoge->hage[0] = 2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment