Created
August 10, 2012 20:42
-
-
Save aheadley/3317685 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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()); |
This file contains hidden or 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 -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