Skip to content

Instantly share code, notes, and snippets.

@Trainmaster
Last active December 20, 2015 04:28
Show Gist options
  • Save Trainmaster/6070837 to your computer and use it in GitHub Desktop.
Save Trainmaster/6070837 to your computer and use it in GitHub Desktop.
<?php
class Foo
{
protected $bar;
public function __construct()
{
$this->bar = 'bar';
}
public function __toString()
{
return $this->bar;
}
public function setBar($bar)
{
$this->bar = (string) $bar;
}
}
$foo = new Foo;
print $foo;
$foo->setBar('baz');
print $foo;
$foo->__construct();
print $foo;
// barbazbar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment