Skip to content

Instantly share code, notes, and snippets.

@Wuvist
Created October 10, 2012 06:30
Show Gist options
  • Save Wuvist/3863491 to your computer and use it in GitHub Desktop.
Save Wuvist/3863491 to your computer and use it in GitHub Desktop.
<?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