3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class MyClass { public function calc($a){ function some($b){ //echo $privateVar; return ($b * 3); } $privateVar = 100; $c = $this->some($a) * 2; echo $privateVar . "\n"; return $c; } } $test = new MyClass(); $saveValue = $test->calc(10); echo $saveValue;
based on TrdZG
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined method MyClass::some() in /in/cULUs:10 Stack trace: #0 /in/cULUs(17): MyClass->calc(10) #1 {main} thrown in /in/cULUs on line 10
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Fatal error: Call to undefined method MyClass::some() in /in/cULUs on line 10
Process exited with code 255.