Skip to content

Instantly share code, notes, and snippets.

@aheadley
Created August 10, 2012 20:42
Show Gist options
  • Save aheadley/3317685 to your computer and use it in GitHub Desktop.
Save aheadley/3317685 to your computer and use it in GitHub Desktop.
<?php
class A {
protected $_member = 'hurr';
public function get_a() {
return $this->_member;
}
}
class B extends A {
public function set_A_a( $obj, $value ) {
$obj->_member = $value;
}
}
$a = new A();
$b = new B();
var_dump($a->get_a());
$b->set_A_a($a, 'im a durr');
var_dump($a->get_a());
$ php -f lol.php
string(4) "hurr"
string(9) "im a durr"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment