3v4l.org

run code in 300+ PHP versions simultaneously
<?php define( 'ANIMAL', 'turtles!' ); $constant = constant(...); echo "I like {$constant('ANIMAL')}"; echo PHP_EOL; echo PHP_EOL; $fn = 'substr'; echo "I like {$fn('turtles!', 0, -1)}"; echo PHP_EOL; echo PHP_EOL; $escape = fn( $string ) => htmlspecialchars( (string) $string, ENT_QUOTES, 'utf-8' ); $userText = "<script>alert('xss')</script>"; echo "You entered {$escape( $userText )}"; echo PHP_EOL; echo PHP_EOL; class Arr { public static function get( $array, $key, $default = null ) { return is_array( $array ) && array_key_exists( $key, $array ) ? $array[$key] : $default; } } $fn = array( 'Arr', 'get' ); echo "I like {$fn(['turtles'], 0)}!";

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.2.110.0130.00720.30
8.2.40.0080.00817.62
8.2.30.0170.00017.62
8.2.20.0080.00817.62
8.2.10.0160.00017.62
8.2.00.0080.00817.62
8.1.170.0170.00017.62
8.1.160.0160.00317.62
8.1.150.0130.00817.62
8.1.140.0110.00617.62
8.1.130.0140.00517.62
8.1.120.0180.00417.62
8.1.110.0140.00417.62
8.1.100.0140.00517.62
8.1.90.0140.00317.62
8.1.80.0150.00317.62
8.1.70.0150.00317.62
8.1.60.0090.00917.62
8.1.50.0140.00317.62
8.1.40.0060.01317.62
8.1.30.0110.00717.62
8.1.20.0120.00517.62
8.1.10.0090.00917.62
8.1.00.0140.00417.62
8.0.280.0000.01517.62
8.0.270.0140.00317.62
8.0.260.0050.01017.62
8.0.250.0120.00417.62
8.0.240.0110.00517.62
8.0.230.0100.00517.62
8.0.220.0130.00317.62
8.0.210.0110.00417.62
8.0.200.0100.00517.62
8.0.190.0150.00017.62
8.0.180.0140.00317.62
8.0.170.0120.00317.62
8.0.160.0100.00517.62
8.0.150.0080.00817.62
8.0.140.0150.00017.62
8.0.130.0100.00517.62
8.0.120.0160.00017.62
8.0.110.0140.00017.62
8.0.100.0110.00517.62
8.0.90.0140.00017.62
8.0.80.0120.00417.62
8.0.70.0060.01117.62
8.0.60.0150.00017.62
8.0.50.0140.00017.62
8.0.30.0150.00017.62
8.0.20.0160.00017.62
8.0.10.0090.00617.62

preferences:
134.99 ms | 1398 KiB | 7 Q