3v4l.org

run code in 300+ PHP versions simultaneously
<?php define("CLI", !isset($_SERVER['HTTP_USER_AGENT'])); $lt = (CLI) ? "\r\n" : "<br />"; /** * Abstract Surfer Class * * @package hangten */ abstract class Surfer { abstract public function rideWave($amplitude); public function applyWax($waxType){ echo("Ahh, all waxed up with '".$waxType."', ready to go!" . $lt); } public function paddleOut(){ echo("Paddling...." . $lt); } public function screamShark(){ echo("SHARK!!" . $lt); } } /** * RookieSurfer Class * * This surfer is green and can barely surf =) * @package hangten */ class RookieSurfer extends Surfer { public function rideWave($amplitude = 1){ echo("Trying.. Trying.. to ride a ".$amplitude."ft. wave, whew!" . $lt); } } /** * ProSurfer Class * * This surfer is crazy skilled!! * @package hangten */ class ProSurfer extends Surfer { public function rideWave($amplitude = 8){ echo("Riding a ".$amplitude."ft. wave backwards doing a backflip!" . $lt); } public function killSharkWithBoard(){ echo("totally just sliced that shark in two, he's over it!! booya!" . $lt); } } // Rookie Instantiation $rookie = new RookieSurfer; $rookie->applyWax("Candle Wax"); $rookie->paddleOut(); $rookie->rideWave(2); $rookie->screamShark(); // Pro Instantiation $pro = new ProSurfer; $pro->applyWax("Sex Wax"); $pro->paddleOut(); $pro->rideWave(50); $pro->killSharkWithBoard();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined variable $lt in /in/NkfbA on line 14 Ahh, all waxed up with 'Candle Wax', ready to go! Warning: Undefined variable $lt in /in/NkfbA on line 18 Paddling.... Warning: Undefined variable $lt in /in/NkfbA on line 35 Trying.. Trying.. to ride a 2ft. wave, whew! Warning: Undefined variable $lt in /in/NkfbA on line 22 SHARK!! Warning: Undefined variable $lt in /in/NkfbA on line 14 Ahh, all waxed up with 'Sex Wax', ready to go! Warning: Undefined variable $lt in /in/NkfbA on line 18 Paddling.... Warning: Undefined variable $lt in /in/NkfbA on line 48 Riding a 50ft. wave backwards doing a backflip! Warning: Undefined variable $lt in /in/NkfbA on line 52 totally just sliced that shark in two, he's over it!! booya!
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.5 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Notice: Undefined variable: lt in /in/NkfbA on line 14 Ahh, all waxed up with 'Candle Wax', ready to go! Notice: Undefined variable: lt in /in/NkfbA on line 18 Paddling.... Notice: Undefined variable: lt in /in/NkfbA on line 35 Trying.. Trying.. to ride a 2ft. wave, whew! Notice: Undefined variable: lt in /in/NkfbA on line 22 SHARK!! Notice: Undefined variable: lt in /in/NkfbA on line 14 Ahh, all waxed up with 'Sex Wax', ready to go! Notice: Undefined variable: lt in /in/NkfbA on line 18 Paddling.... Notice: Undefined variable: lt in /in/NkfbA on line 48 Riding a 50ft. wave backwards doing a backflip! Notice: Undefined variable: lt in /in/NkfbA on line 52 totally just sliced that shark in two, he's over it!! booya!
Output for 7.3.32 - 7.3.33, 7.4.26
Ahh, all waxed up with 'Candle Wax', ready to go!Paddling....Trying.. Trying.. to ride a 2ft. wave, whew!SHARK!!Ahh, all waxed up with 'Sex Wax', ready to go!Paddling....Riding a 50ft. wave backwards doing a backflip!totally just sliced that shark in two, he's over it!! booya!
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Fatal error: Declaration of RookieSurfer::rideWave() must be compatible with that of Surfer::rideWave() in /in/NkfbA on line 37
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CLASS in /in/NkfbA on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_CLASS in /in/NkfbA on line 9
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/NkfbA on line 9
Process exited with code 255.

preferences:
251.34 ms | 401 KiB | 379 Q