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 {}"); file_put_contents($base_dir . 'Buz.php', "<?php namespace Foo\Bar; class Buz {}"); 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()); var_dump(new \Foo\Bar\BUZ()); var_dump(new \Foo\Bar\Buz());

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.0140.00418.68
8.3.50.0150.00721.21
8.3.40.0000.01519.01
8.3.30.0070.00720.18
8.3.20.0000.00818.85
8.3.10.0000.00821.04
8.3.00.0040.00422.27
8.2.180.0090.01318.91
8.2.170.0100.00322.96
8.2.160.0100.00320.38
8.2.150.0000.00824.18
8.2.140.0090.00024.66
8.2.130.0000.00826.16
8.2.120.0040.00420.95
8.2.110.0040.00420.38
8.2.100.0170.00017.78
8.2.90.0000.00817.75
8.2.80.0080.00018.86
8.2.70.0030.00517.75
8.2.60.0050.00317.75
8.2.50.0040.00417.93
8.2.40.0030.00618.04
8.2.30.0000.00919.86
8.2.20.0000.00717.84
8.2.10.0000.00717.87
8.2.00.0040.00417.86
8.1.280.0120.00625.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00923.91
8.1.230.0080.00317.83
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0040.00417.35
8.1.180.0050.00318.10
8.1.170.0000.00817.62
8.1.160.0040.00418.85
8.1.150.0000.00918.70
8.1.140.0040.00417.46
8.1.130.0000.00717.93
8.1.120.0000.00817.42
8.1.110.0030.00517.55
8.1.100.0040.00417.41
8.1.90.0040.00417.52
8.1.80.0070.00017.52
8.1.70.0000.00717.52
8.1.60.0000.00817.69
8.1.50.0030.00517.63
8.1.40.0000.00817.59
8.1.30.0080.00017.76
8.1.20.0000.00817.79
8.1.10.0030.00517.60
8.1.00.0000.00817.59
8.0.300.0050.00318.77
8.0.290.0040.00416.75
8.0.280.0000.00718.55
8.0.270.0050.00317.36
8.0.260.0000.00716.89
8.0.250.0000.00717.11
8.0.240.0040.00417.12
8.0.230.0030.00317.12
8.0.220.0030.00317.10
8.0.210.0070.00017.03
8.0.200.0000.00717.12
8.0.190.0040.00416.99
8.0.180.0040.00416.98
8.0.170.0060.00316.97
8.0.160.0040.00416.98
8.0.150.0050.00216.90
8.0.140.0040.00416.99
8.0.130.0050.00213.56
8.0.120.0080.00016.95
8.0.110.0040.00417.02
8.0.100.0070.00016.94
8.0.90.0040.00417.10
8.0.80.0170.00017.10
8.0.70.0040.00417.10
8.0.60.0000.00817.02
8.0.50.0040.00416.88
8.0.30.0110.00817.16
8.0.20.0160.00317.40
8.0.10.0040.00417.08
8.0.00.0080.01116.84
7.4.330.0000.00516.67
7.4.320.0060.00016.61
7.4.300.0000.00616.51
7.4.290.0030.00316.57
7.4.280.0070.00016.64
7.4.270.0000.00716.55
7.4.260.0000.00613.33
7.4.250.0000.00716.41
7.4.240.0080.00016.57
7.4.230.0000.00716.66
7.4.220.0060.01216.44
7.4.210.0060.01116.64
7.4.200.0030.00316.65
7.4.190.0000.00716.46
7.4.160.0170.00716.64
7.4.150.0060.01217.40
7.4.140.0100.00717.86
7.4.130.0090.00916.68
7.4.120.0100.01016.70
7.4.110.0140.00316.68
7.4.100.0090.00916.66
7.4.90.0110.01416.53
7.4.80.0130.00719.39
7.4.70.0120.01216.63
7.4.60.0180.00516.45
7.4.50.0040.00416.50
7.4.40.0120.00822.77
7.4.30.0090.01216.71
7.4.00.0040.01214.93
7.3.330.0020.00213.46
7.3.320.0060.00013.29
7.3.310.0030.00316.52
7.3.300.0000.00816.54
7.3.290.0000.01716.54
7.3.280.0050.01316.49
7.3.270.0140.00417.40
7.3.260.0110.01118.24
7.3.250.0100.01216.56
7.3.240.0030.01416.45
7.3.230.0130.00416.42
7.3.210.0110.00616.55
7.3.200.0100.01419.39
7.3.190.0090.00916.45
7.3.180.0090.00916.52
7.3.170.0070.01016.63
7.3.160.0150.00616.53
7.3.120.0040.01114.94
7.3.10.0110.01416.08
7.3.00.0110.01116.27
7.2.330.0110.00816.84
7.2.320.0150.00316.77
7.2.310.0070.01116.77
7.2.300.0070.01016.78
7.2.290.0090.00916.67
7.2.130.0150.00616.49
7.2.120.0140.00316.55
7.2.110.0110.00416.55
7.2.100.0170.00716.74
7.2.90.0100.01016.66
7.2.80.0140.00816.38
7.2.70.0150.00716.59
7.2.60.0100.00816.66
7.2.50.0160.00916.46
7.2.40.0130.00716.55
7.2.30.0110.01116.71
7.2.20.0090.00916.42
7.2.10.0130.00716.45
7.2.00.0070.01217.96
7.1.250.0060.00915.26
7.1.200.0090.00315.56
7.1.70.0100.00017.04
7.1.60.0170.00719.17
7.1.50.0240.01434.94
7.1.00.0030.03322.55
7.0.200.0000.01216.88
7.0.140.0070.07022.00
7.0.100.0170.07720.00
7.0.90.0230.09019.99
7.0.80.0230.09019.98
7.0.70.0100.06019.93
7.0.60.0100.07319.98
7.0.50.0070.05320.32
7.0.40.0070.08020.07
7.0.30.0070.06320.20
7.0.20.0200.07320.16
7.0.10.0070.08720.10
7.0.00.0030.08719.96
5.6.250.0130.07320.83
5.6.240.0130.07720.65
5.6.230.0130.04320.58
5.6.220.0130.06320.63
5.6.210.0100.05320.62
5.6.200.0030.07021.09
5.6.190.0170.07321.19
5.6.180.0200.04721.18
5.6.170.0100.09021.04
5.6.160.0130.08321.19
5.6.150.0070.08321.15
5.6.140.0100.08020.97
5.6.130.0070.08721.05
5.6.120.0100.07321.09
5.6.110.0130.04021.14
5.6.100.0030.05321.02
5.6.90.0100.04321.01
5.6.80.0100.03720.57
5.6.70.0100.04720.56
5.6.60.0130.04720.34
5.6.50.0100.04020.52
5.6.40.0130.03720.33
5.6.30.0030.08320.55
5.6.20.0130.09020.39
5.6.10.0030.07020.32
5.6.00.0100.07320.40
5.5.380.0030.08020.58
5.5.370.0000.09020.36
5.5.360.0100.08020.50
5.5.350.0130.07720.44
5.5.340.0200.06320.80
5.5.330.0000.04720.94
5.5.320.0030.08320.95
5.5.310.0170.08020.95
5.5.300.0070.08320.86
5.5.290.0070.08320.96
5.5.280.0100.04320.90
5.5.270.0070.07720.90
5.5.260.0100.08020.74
5.5.250.0100.07020.66
5.5.240.0130.06020.31
5.5.230.0130.09020.17
5.5.220.0070.08020.18
5.5.210.0100.07020.20
5.5.200.0100.08320.17
5.5.190.0030.05720.29
5.5.180.0030.08020.24
5.5.160.0070.07720.27
5.5.150.0100.07020.19
5.5.140.0030.04320.26
5.5.130.0000.05720.25
5.5.120.0070.07720.25
5.5.110.0130.06319.98
5.5.100.0130.07320.10
5.5.90.0100.05020.14
5.5.80.0000.05020.18
5.5.70.0070.07020.05
5.5.60.0000.08320.02
5.5.50.0170.07020.16
5.5.40.0130.07320.08
5.5.30.0100.08020.11
5.5.20.0100.05719.95
5.5.10.0030.08020.06
5.5.00.0000.06720.04
5.4.450.0030.07719.21
5.4.440.0000.04719.57
5.4.430.0000.08019.46
5.4.420.0170.06719.18
5.4.410.0070.08319.23
5.4.400.0070.06019.14
5.4.390.0100.07019.13
5.4.380.0070.07718.91
5.4.370.0030.04319.21
5.4.360.0100.05319.06
5.4.350.0130.07019.10
5.4.340.0170.06718.86
5.4.320.0070.08019.24
5.4.310.0030.05719.14
5.4.300.0200.07019.16
5.4.290.0100.07318.95
5.4.280.0070.04319.09
5.4.270.0030.05719.21
5.4.260.0300.05319.13
5.4.250.0000.07718.84
5.4.240.0070.07719.23
5.4.230.0100.06719.04
5.4.220.0030.07718.88
5.4.210.0070.08019.09
5.4.200.0070.06719.13
5.4.190.0100.07318.87
5.4.180.0100.07318.84
5.4.170.0070.03719.14
5.4.160.0000.04718.84
5.4.150.0000.04319.21
5.4.140.0100.04016.45
5.4.130.0030.04016.42
5.4.120.0030.04016.35
5.4.110.0030.03016.28
5.4.100.0030.03316.40
5.4.90.0070.04716.50
5.4.80.0030.06716.50
5.4.70.0030.03716.35
5.4.60.0130.06316.50
5.4.50.0070.03316.39
5.4.40.0070.03316.37
5.4.30.0030.06016.41
5.4.20.0000.04716.44
5.4.10.0000.03716.42
5.4.00.0030.04316.03
5.3.290.0030.07014.82
5.3.280.0070.07714.73
5.3.270.0200.06714.68
5.3.260.0100.05014.73
5.3.250.0070.03314.67
5.3.240.0030.04014.61
5.3.230.0030.03014.62
5.3.220.0030.03314.53
5.3.210.0000.04314.54
5.3.200.0070.03014.72
5.3.190.0070.03014.68
5.3.180.0070.04314.63
5.3.170.0170.06714.63
5.3.160.0070.06014.69
5.3.150.0070.05314.70
5.3.140.0030.03314.56
5.3.130.0030.07014.64
5.3.120.0070.07314.59
5.3.110.0030.05714.63
5.3.100.0030.04013.98
5.3.90.0000.04014.10
5.3.80.0030.03714.09
5.3.70.0000.04013.96
5.3.60.0030.04314.12
5.3.50.0030.03314.07
5.3.40.0030.03714.09
5.3.30.0100.02314.03
5.3.20.0030.03713.73
5.3.10.0070.03013.73
5.3.00.0000.03313.72
5.2.170.0130.02010.96
5.2.160.0000.03311.09
5.2.150.0030.03011.14
5.2.140.0000.03711.18
5.2.130.0030.02711.04
5.2.120.0000.03310.94
5.2.110.0070.03311.12
5.2.100.0000.02711.02
5.2.90.0000.03011.05
5.2.80.0000.03311.14
5.2.70.0000.03311.11
5.2.60.0030.03311.09
5.2.50.0030.02311.09
5.2.40.0000.05010.79
5.2.30.0030.05310.97
5.2.20.0030.03011.00
5.2.10.0030.03710.81
5.2.00.0000.06310.77
5.1.60.0030.0509.98
5.1.50.0030.0509.88
5.1.40.0070.0339.96
5.1.30.0070.04710.31
5.1.20.0000.04010.40
5.1.10.0030.05010.10
5.1.00.0070.05310.07
5.0.50.0230.0179.73
5.0.40.0000.0439.73
5.0.30.0030.0339.73
5.0.20.0070.0179.73
5.0.10.0000.0509.73
5.0.00.0030.0609.73
4.4.90.0000.0139.73
4.4.80.0000.0179.73
4.4.70.0030.0339.73
4.4.60.0030.0239.73
4.4.50.0000.0379.73
4.4.40.0000.0479.73
4.4.30.0070.0379.73
4.4.20.0070.0309.73
4.4.10.0030.0309.73
4.4.00.0000.0579.73
4.3.110.0030.0309.73
4.3.100.0030.0339.73
4.3.90.0100.0279.73
4.3.80.0000.0539.73
4.3.70.0030.0339.73
4.3.60.0000.0339.73
4.3.50.0030.0239.73
4.3.40.0030.0509.73
4.3.30.0000.0209.73
4.3.20.0030.0339.73
4.3.10.0000.0279.73
4.3.00.0000.0239.73

preferences:
45.02 ms | 401 KiB | 5 Q