3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php /** * Abstract Surfer Class * * @package hangten */ abstract class Surfer { abstract protected function rideWave($amplitude); public function applyWax($waxType){ echo("Ahh, all waxed up with '".$waxType."'. Ready to go!"); } public function paddleOut(){ echo("Paddling...."); } public function screamShark(){ echo("SHARK!!"); } } /** * RookieSurfer Class * * This surfer is green and can barely surf. * @package hangten */ class RookieSurfer extends Surfer { protected function rideWave($amplitude = 1){ echo("Trying.. Trying.. to ride a ".$amplitude."ft. wave, whew!"); } } /** * ProSurfer Class * * This surfer is crazy skilled!! * @package hangten */ class ProSurfer extends Surfer { protected function rideWave($amplitude = 8){ echo("Riding a ".$amplitude."ft. wave backwards doing a backflip!"); } } $rookie = new RookieSurfer; $rookie->applyWax('candleWax')->paddleout()->rideWave(2);
Output for 7.0.0 - 7.1.0
Ahh, all waxed up with 'candleWax'. Ready to go! Fatal error: Uncaught Error: Call to a member function paddleout() on null in /in/bssEi:53 Stack trace: #0 {main} thrown in /in/bssEi on line 53
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Ahh, all waxed up with 'candleWax'. Ready to go! Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function paddleout() on a non-object (null)' in /in/bssEi:53 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.22
Ahh, all waxed up with 'candleWax'. Ready to go! Fatal error: Call to a member function paddleout() on null in /in/bssEi on line 53
Process exited with code 255.
Output for 5.3.0 - 5.5.36
Ahh, all waxed up with 'candleWax'. Ready to go! Fatal error: Call to a member function paddleout() on a non-object in /in/bssEi on line 53
Process exited with code 255.
Output for 5.0.0 - 5.2.17
Fatal error: Declaration of RookieSurfer::rideWave() must be compatible with that of Surfer::rideWave() in /in/bssEi on line 36
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CLASS in /in/bssEi on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_CLASS in /in/bssEi on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/bssEi on line 8
Process exited with code 255.