Created
April 9, 2012 08:18
-
-
Save parap/2342272 to your computer and use it in GitHub Desktop.
This file contains 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 { | |
public function test() { | |
$this->abc[] = 'test'; | |
} | |
} | |
class B extends A { | |
public $abc = array('pre-test'); | |
} | |
$a = new A(); | |
print_r($a); | |
echo'<br>'; | |
$a->test(); | |
print_r($a); | |
echo'<br>'; | |
$b = new B(); | |
print_r($b); | |
echo'<br>'; | |
$b->test(); | |
print_r($b); | |
// output is | |
// B Object ( [abc] => Array ( [0] => pre-test [1] => test ) ) | |
// - property is populated properly |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment