Created
October 10, 2012 06:30
-
-
Save Wuvist/3863491 to your computer and use it in GitHub Desktop.
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 DummyClass | |
{ | |
public $msg; | |
} | |
$obj = new DummyClass(); | |
$obj->msg = "Hello World"; | |
echo $obj->msg.PHP_EOL; | |
class DummyClass2 | |
{ | |
private $_msg; | |
public function __get($key) | |
{ | |
if ($key == "msg") | |
return str_replace(" ", "", $this->_msg); | |
} | |
public function __set($key, $val) | |
{ | |
if ($key == "msg") | |
return $this->_msg = $val; | |
} | |
} | |
$obj = new DummyClass2(); | |
$obj->msg = "Hello World"; | |
echo $obj->msg.PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment