Skip to content

Instantly share code, notes, and snippets.

@olvlvl
Created May 6, 2013 20:22
Show Gist options
  • Save olvlvl/5527872 to your computer and use it in GitHub Desktop.
Save olvlvl/5527872 to your computer and use it in GitHub Desktop.
<?php
class Baz
{
protected $foo;
public function __construct($foo)
{
$this->foo = $foo;
}
public function __get($property)
{
if ($property == 'x')
{
return $this->foo->x;
}
}
}
$bar = new Baz((object) array('x' => 16));
echo $bar->x ; // 16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment