3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PHPApprentice { private static $velocity = ''; private static $initialized = false; public static function initialize () { if ( self::initialized ) return; self::$initialized = true; self::$velocity = 'fast!'; } public static function getVelocity () { self::initialize(); return self::$velocity; } public static function setVelocity ( $value ) { self::$velocity = $value; self::initialized = true; } } PHPApprentice::setVelocity ( 'Ludicrous Speed!!' ); echo PHPApprentice::getVelocity();
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.23
Parse error: syntax error, unexpected '=' in /in/LkDjR on line 24
Process exited with code 255.

preferences:
180.35 ms | 1395 KiB | 60 Q