3v4l.org

run code in 300+ PHP versions simultaneously
<?php $base_dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR; file_put_contents($base_dir . 'Baz.php', "<?php namespace Foo\Bar; class Baz {}"); spl_autoload_register(function ($class) { // project-specific namespace prefix $prefix = 'Foo\\Bar\\'; // base directory for the namespace prefix global $base_dir; // does the class use the namespace prefix? $len = strlen($prefix); if (strncmp($prefix, $class, $len) !== 0) { // no, move to the next registered autoloader return; } // get the relative class name $relative_class = substr($class, $len); // replace the namespace prefix with the base directory, replace namespace // separators with directory separators in the relative class name, append // with .php $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; // if the file exists, require it if (file_exists($file)) { require $file; } }); var_dump(new \Foo\Bar\Baz()); var_dump(new \Foo\Bar\BAZ());

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.3.60.0150.00618.41
8.3.50.0100.01021.27
8.3.40.0070.01118.84
8.3.30.0110.00420.17
8.3.20.0050.00318.87
8.3.10.0030.00621.05
8.3.00.0080.00022.45
8.2.180.0110.00716.63
8.2.170.0000.01422.96
8.2.160.0030.01020.30
8.2.150.0090.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0030.00521.18
8.2.110.0030.00619.34
8.2.100.0090.00317.75
8.2.90.0030.00519.26
8.2.80.0000.00818.03
8.2.70.0040.00717.38
8.2.60.0030.00517.80
8.2.50.0040.00418.07
8.2.40.0000.00818.21
8.2.30.0050.00319.78
8.2.20.0030.00617.69
8.2.10.0000.00817.69
8.2.00.0080.00017.82
8.1.280.0040.01225.92
8.1.270.0080.00023.99
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0040.00721.96
8.1.230.0040.00820.84
8.1.220.0060.00318.77
8.1.210.0050.00318.80
8.1.200.0000.01117.35
8.1.190.0050.00317.53
8.1.180.0040.00418.10
8.1.170.0000.00918.50
8.1.160.0040.00418.97
8.1.150.0080.00018.58
8.1.140.0070.00017.46
8.1.130.0070.00017.76
8.1.120.0040.00417.45
8.1.110.0040.00417.54
8.1.100.0070.00017.54
8.1.90.0040.00417.51
8.1.80.0000.00717.49
8.1.70.0000.00717.46
8.1.60.0040.00417.71
8.1.50.0000.00917.61
8.1.40.0040.00417.59
8.1.30.0030.00517.64
8.1.20.0030.00517.79
8.1.10.0060.00317.66
8.1.00.0000.00717.53
8.0.300.0000.00720.02
8.0.290.0000.00716.88
8.0.280.0030.00318.52
8.0.270.0000.00717.34
8.0.260.0000.00716.85
8.0.250.0030.00317.08
8.0.240.0060.00317.05
8.0.230.0030.00316.91
8.0.220.0030.00317.00
8.0.210.0070.00016.85
8.0.200.0030.00316.98
8.0.190.0000.00716.99
8.0.180.0080.00017.02
8.0.170.0040.00416.87
8.0.160.0000.00716.94
8.0.150.0070.00016.88
8.0.140.0000.00816.92
8.0.130.0030.00313.38
8.0.120.0030.00516.83
8.0.110.0080.00016.79
8.0.100.0070.00016.93
8.0.90.0040.00416.83
8.0.80.0120.00316.91
8.0.70.0000.00817.02
8.0.60.0000.00816.84
8.0.50.0020.00516.91
8.0.30.0090.00917.06
8.0.20.0090.01117.40
8.0.10.0070.00017.05
8.0.00.0140.00616.77
7.4.330.0000.00616.87
7.4.320.0030.00316.56
7.4.300.0030.00316.60
7.4.290.0070.00016.70
7.4.280.0040.00416.46
7.4.270.0040.00416.61
7.4.260.0030.00313.32
7.4.250.0000.00716.54
7.4.240.0030.00316.53
7.4.230.0070.00016.50
7.4.220.0080.01216.59
7.4.210.0090.00716.55
7.4.200.0040.00316.72
7.4.190.0040.00416.49
7.4.160.0100.00616.48
7.4.150.0160.00417.40
7.4.140.0130.00517.86
7.4.130.0140.00416.68
7.4.120.0090.00916.54
7.4.110.0090.00916.82
7.4.100.0150.00316.61
7.4.90.0090.01016.44
7.4.80.0150.00719.39
7.4.70.0110.00516.36
7.4.60.0140.00716.64
7.4.50.0000.00816.47
7.4.40.0030.01322.77
7.4.30.0130.00616.56
7.4.00.0100.00314.71
7.3.330.0000.00513.39
7.3.320.0060.00013.30
7.3.310.0070.00016.34
7.3.300.0040.00416.46
7.3.290.0090.00616.33
7.3.280.0060.00916.46
7.3.270.0140.00317.40
7.3.260.0130.01218.24
7.3.250.0060.01116.46
7.3.240.0070.01016.61
7.3.230.0060.01216.39
7.3.210.0130.00316.43
7.3.200.0110.01419.39
7.3.190.0100.01016.44
7.3.180.0090.00616.31
7.3.170.0030.01216.57
7.3.160.0040.01716.30
7.3.120.0040.00415.07
7.2.330.0060.01216.62
7.2.320.0110.00716.58
7.2.310.0090.01516.55
7.2.300.0070.01016.71
7.2.290.0100.00716.80
7.2.60.0060.00617.07
7.2.00.0030.01019.52
7.1.200.0060.00615.43
7.1.100.0030.00918.18
7.1.70.0050.00216.88
7.1.60.0130.01319.17
7.1.50.0090.00916.79
7.1.00.0000.03722.37
7.0.200.0070.01116.78
7.0.140.0070.07022.10
7.0.100.0200.08319.89
7.0.90.0100.04320.16
7.0.80.0230.06719.95
7.0.70.0030.08319.98
7.0.60.0130.08020.07
7.0.50.0070.05720.38
7.0.40.0070.04720.12
7.0.30.0100.07020.06
7.0.20.0000.09020.15
7.0.10.0100.07320.10
7.0.00.0030.08720.19
5.6.280.0030.07321.04
5.6.250.0070.07320.77
5.6.240.0030.06020.68
5.6.230.0170.07320.76
5.6.220.0100.08020.72
5.6.210.0030.06020.63
5.6.200.0030.04321.11
5.6.190.0130.07320.97
5.6.180.0070.08021.12
5.6.170.0170.07021.13
5.6.160.0070.05021.10
5.6.150.0100.06721.04
5.6.140.0070.04021.14
5.6.130.0070.03321.03
5.6.120.0070.04021.00
5.6.110.0030.04020.95
5.6.100.0030.04321.11
5.6.90.0100.04021.07
5.6.80.0070.03320.50
5.6.70.0030.08320.50
5.6.60.0130.07020.49
5.6.50.0030.04720.36
5.6.40.0070.03720.48
5.6.30.0030.04720.30
5.6.20.0030.04020.40
5.6.10.0070.03320.30
5.6.00.0000.04320.39
5.5.380.0100.06720.41
5.5.370.0100.04020.39
5.5.360.0170.07320.52
5.5.350.0130.07320.47
5.5.340.0100.04020.82
5.5.330.0130.06020.94
5.5.320.0130.08320.91
5.5.310.0100.04320.66
5.5.300.0070.04320.93
5.5.290.0070.04020.90
5.5.280.0030.04320.62
5.5.270.0030.05020.87
5.5.260.0100.04020.93
5.5.250.0030.04720.69
5.5.240.0070.07320.29
5.5.230.0070.08320.29
5.5.220.0130.08020.27
5.5.210.0030.04020.20
5.5.200.0100.03020.23
5.5.190.0070.03720.29
5.5.180.0030.04020.29
5.5.160.0000.04320.15
5.5.150.0030.03720.09
5.5.140.0030.05020.25
5.5.130.0030.06019.97
5.5.120.0030.04020.25
5.5.110.0000.04720.15
5.5.100.0030.04020.18
5.5.90.0070.03720.18
5.5.80.0030.04020.17
5.5.70.0070.03720.08
5.5.60.0030.04020.03
5.5.50.0070.03020.21
5.5.40.0030.04020.17
5.5.30.0030.04020.10
5.5.20.0100.03020.16
5.5.10.0000.04720.05
5.5.00.0030.04020.03
5.4.450.0100.04019.37
5.4.440.0100.03319.57
5.4.430.0000.04019.45
5.4.420.0030.03719.18
5.4.410.0030.04319.41
5.4.400.0100.07019.09
5.4.390.0070.08019.14
5.4.380.0000.05719.19
5.4.370.0100.03019.24
5.4.360.0070.03719.14
5.4.350.0130.04019.05
5.4.340.0070.03719.05
5.4.320.0000.04719.22
5.4.310.0000.03719.15
5.4.300.0000.04319.09
5.4.290.0070.03019.03
5.4.280.0030.03719.09
5.4.270.0000.03719.20
5.4.260.0070.03719.05
5.4.250.0000.04019.23
5.4.240.0030.03719.05
5.4.230.0000.04019.09
5.4.220.0030.03019.05
5.4.210.0030.03019.09
5.4.200.0100.02719.02
5.4.190.0000.04018.89
5.4.180.0000.03718.91
5.4.170.0030.03719.12
5.4.160.0000.04719.02
5.4.150.0000.04019.21
5.4.140.0070.06316.26
5.4.130.0100.06716.46
5.4.120.0130.06316.43
5.4.110.0030.05716.28
5.4.100.0100.04316.39
5.4.90.0070.06316.41
5.4.80.0070.07016.38
5.4.70.0130.03316.38
5.4.60.0100.03716.31
5.4.50.0030.06016.37
5.4.40.0030.05316.36
5.4.30.0100.07716.48
5.4.20.0030.05016.25
5.4.10.0070.05716.46
5.4.00.0070.07015.90
5.3.290.0000.03714.79
5.3.280.0070.03714.54
5.3.270.0070.03714.59
5.3.260.0100.03314.57
5.3.250.0070.03314.71
5.3.240.0130.06714.71
5.3.230.0200.06714.67
5.3.220.0130.06314.65
5.3.210.0030.08014.51
5.3.200.0100.03714.56
5.3.190.0070.07014.70
5.3.180.0100.07014.61
5.3.170.0070.07314.64
5.3.160.0070.07714.64
5.3.150.0070.07314.69
5.3.140.0030.06014.52
5.3.130.0070.08314.59
5.3.120.0070.04314.59
5.3.110.0070.05714.63
5.3.100.0070.07714.06
5.3.90.0100.07313.96
5.3.80.0070.06314.02
5.3.70.0030.08314.12
5.3.60.0100.06314.07
5.3.50.0000.08713.90
5.3.40.0100.05013.97
5.3.30.0170.06013.90
5.3.20.0030.04013.65
5.3.10.0070.05713.73
5.3.00.0030.04013.71
5.2.170.0000.06013.65
5.2.160.0000.06313.65
5.2.150.0000.04013.65
5.2.140.0000.05713.65
5.2.130.0130.03713.65
5.2.120.0030.03313.65
5.2.110.0000.03313.65
5.2.100.0070.02713.65
5.2.90.0000.06313.65
5.2.80.0100.04013.65
5.2.70.0070.06013.65
5.2.60.0030.05013.65
5.2.50.0030.05013.65
5.2.40.0030.03313.65
5.2.30.0100.04313.65
5.2.20.0030.05013.65
5.2.10.0030.05313.65
5.2.00.0070.06013.65
5.1.60.0000.03013.65
5.1.50.0130.04713.65
5.1.40.0100.04313.65
5.1.30.0070.05313.65
5.1.20.0000.03013.65
5.1.10.0000.05313.65
5.1.00.0000.03313.65
5.0.50.0070.04013.65
5.0.40.0030.02713.65
5.0.30.0000.03713.65
5.0.20.0100.02313.65
5.0.10.0030.02013.65
5.0.00.0030.06013.65
4.4.90.0030.03713.65
4.4.80.0000.03013.65
4.4.70.0070.01713.65
4.4.60.0070.01313.65
4.4.50.0070.02313.65
4.4.40.0000.03013.65
4.4.30.0030.03313.65
4.4.20.0030.02713.65
4.4.10.0000.02013.65
4.4.00.0000.03713.65
4.3.110.0000.02013.65
4.3.100.0030.03013.65
4.3.90.0070.02713.65
4.3.80.0100.04013.65
4.3.70.0030.01313.65
4.3.60.0030.03313.65
4.3.50.0000.03713.65
4.3.40.0000.03013.65
4.3.30.0000.03313.65
4.3.20.0000.03013.65
4.3.10.0000.03713.65
4.3.00.0000.02713.65

preferences:
40.48 ms | 401 KiB | 5 Q