3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Foo { private static $instance = NULL; private function __construct() { } public static function getInstance() { return static::$instance === NULL ? static::$instance = new static() ? static::$instance; } } final class Bar extends Foo { } final class Baz extends Foo { } $bar = Bar::getInstance(); echo get_class($bar), "\n"; $baz = Baz::getInstance(); echo get_class($baz), "\n";

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)
5.4.240.0570.05718.95
5.4.230.0500.04019.24
5.4.220.0470.05019.23
5.4.210.0400.05018.87
5.4.200.0470.04319.29
5.4.190.0300.03718.98
5.4.180.0430.03718.98
5.4.170.0470.06019.17
5.4.160.0400.04719.18
5.4.150.0370.05019.29
5.4.140.0400.04016.50
5.4.130.0270.04016.41
5.4.120.0370.03016.33
5.4.110.0430.04316.61
5.4.100.0330.03316.37
5.4.90.0330.03016.37
5.4.80.0300.03316.55
5.4.70.0300.03316.25
5.4.60.0330.04016.24
5.4.50.0300.05016.55
5.4.40.0330.03716.54
5.4.30.0370.03716.32
5.4.20.0200.03316.53
5.4.10.0200.04316.25
5.4.00.0130.03315.80
5.3.280.0330.04714.82
5.3.270.0270.04014.72
5.3.260.0270.04714.61
5.3.250.0330.06314.50
5.3.240.0300.04014.73
5.3.230.0370.04314.50
5.3.220.0300.03714.48
5.3.210.0470.03314.47
5.3.200.0330.03314.49
5.3.190.0330.03314.56
5.3.180.0270.04014.57
5.3.170.0230.04014.49
5.3.160.0270.04014.79
5.3.150.0330.03314.58
5.3.140.0300.03714.45
5.3.130.0300.03714.62
5.3.120.0330.04014.54
5.3.110.0130.03714.57
5.3.100.0200.03314.16
5.3.90.0070.04014.03
5.3.80.0130.03314.18
5.3.70.0170.03313.93
5.3.60.0130.03314.16
5.3.50.0200.03314.02
5.3.40.0170.03314.17
5.3.30.0130.03313.84
5.3.20.0100.03713.62
5.3.10.0070.04013.58
5.3.00.0170.04013.71

preferences:
144.25 ms | 1386 KiB | 7 Q