Created
July 18, 2011 22:24
-
-
Save Intrepidd/1090844 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 ParentClass { | |
protected $a = 1; | |
public function doSomething() { | |
echo "I'm the parent"; | |
$this->a = 2; | |
} | |
} | |
class childClass { | |
public function doSomething() { | |
ParentClass::doSomething(); | |
echo "I'm the child"; | |
echo $this->a; | |
} | |
} | |
$c = new childClass(); | |
$c->doSomething(); |
What's so surprising about the result?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Surprising output!
Try to remove line 13.