3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = function($className) { if (strpos($className, '\\') !== false) { $parts = array_map('strtolower', array_values(explode('\\', $className))); $count = count($parts); $folder = $file = ''; while ($count--) { if ($count >= 1) { $folder .= array_shift($parts) . ($count > 1 ? '/' : ''); } else { $file = array_shift($parts); } } // Not really a great idea if (substr($folder, 0, 3) == 'api') { $folder = str_replace('api', 'controller/api', $folder); } $fileName = ROOT . '/' . $folder . '/' . $file . '.php'; // Reroute \<namespace>\exception.php -> \library\exception.php if ($file == "exception" && $className != 'API\Exception') { $fileName = ROOT . '/library/exception.php'; } if (is_readable($fileName)) { return $fileName; return true; } } return false; }; $b = function($className) { $className = ltrim($className, '\\'); $fileName = ''; $namespace = ''; if ($lastNsPos = strrpos($className, '\\')) { $namespace = substr($className, 0, $lastNsPos); $className = substr($className, $lastNsPos + 1); $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; } $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; return $fileName; }; $tests = [ '\Library\Database::doQuery', '\Vendor\twilio-php\x', '\namespace\package\Class_Name', '\namespace\package_name\Class_Name' ]; echo '<pre>'; foreach ($tests as $test) { echo 'input ', $test, PHP_EOL; echo 'icr: ', $a($test), PHP_EOL; echo 'psr: ', $b($test), PHP_EOL; }

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.0070.00716.75
8.3.50.0130.00521.10
8.3.40.0040.01118.95
8.3.30.0110.00418.83
8.3.20.0060.00920.20
8.3.10.0040.00421.77
8.3.00.0060.00322.46
8.2.180.0150.00716.88
8.2.170.0040.01222.96
8.2.160.0070.01020.35
8.2.150.0000.00925.66
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00417.63
8.2.110.0040.00720.48
8.2.100.0100.00317.63
8.2.90.0040.00419.30
8.2.80.0040.00417.97
8.2.70.0050.00517.59
8.2.60.0030.00617.93
8.2.50.0000.00918.07
8.2.40.0060.00321.04
8.2.30.0000.00819.90
8.2.20.0030.00517.99
8.2.10.0040.00418.16
8.2.00.0040.00418.17
8.1.280.0070.01125.92
8.1.270.0080.00022.14
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0090.00023.98
8.1.230.0090.00317.47
8.1.220.0060.00317.77
8.1.210.0000.00818.77
8.1.200.0100.00317.38
8.1.190.0030.00617.35
8.1.180.0040.00418.10
8.1.170.0080.00018.59
8.1.160.0040.00421.95
8.1.150.0040.00418.86
8.1.140.0060.00317.41
8.1.130.0070.00017.70
8.1.120.0000.01017.54
8.1.110.0050.00317.46
8.1.100.0020.00517.39
8.1.90.0000.00717.51
8.1.80.0000.00717.57
8.1.70.0040.00417.59
8.1.60.0030.00617.70
8.1.50.0050.00317.56
8.1.40.0040.00417.44
8.1.30.0040.00417.75
8.1.20.0000.00817.69
8.1.10.0030.00617.70
8.1.00.0000.00817.42
8.0.300.0080.00018.77
8.0.290.0070.00016.75
8.0.280.0080.00018.41
8.0.270.0000.00817.35
8.0.260.0000.00717.30
8.0.250.0040.00416.94
8.0.240.0000.00717.11
8.0.230.0030.00316.92
8.0.220.0000.00717.01
8.0.210.0050.00216.93
8.0.200.0030.00317.07
8.0.190.0080.00017.02
8.0.180.0050.00316.99
8.0.170.0070.00016.93
8.0.160.0040.00417.02
8.0.150.0000.00816.91
8.0.140.0000.00717.05
8.0.130.0000.00613.37
8.0.120.0060.00317.00
8.0.110.0070.00017.05
8.0.100.0020.00517.11
8.0.90.0040.00417.07
8.0.80.0070.00717.00
8.0.70.0040.00417.07
8.0.60.0070.00016.86
8.0.50.0040.00416.83
8.0.30.0100.00817.12
8.0.20.0110.01117.40
8.0.10.0000.00817.06
8.0.00.0100.00816.67
7.4.330.0050.00015.08
7.4.320.0030.00316.50
7.4.300.0030.00316.64
7.4.290.0030.00316.66
7.4.280.0080.00016.57
7.4.270.0030.00316.68
7.4.260.0000.00716.55
7.4.250.0040.00416.46
7.4.240.0040.00416.65
7.4.230.0000.00716.57
7.4.220.0130.01216.59
7.4.210.0090.01116.61
7.4.200.0050.00316.70
7.4.160.0070.01516.81
7.4.150.0150.00317.40
7.4.140.0100.01117.86
7.4.130.0110.00916.59
7.4.120.0080.01116.63
7.4.110.0150.00316.47
7.4.100.0150.00616.58
7.4.90.0000.01816.76
7.4.80.0060.01219.39
7.4.70.0140.00516.73
7.4.60.0060.01216.47
7.4.50.0030.00316.57
7.4.40.0130.00316.68
7.4.30.0090.01216.39
7.4.00.0000.01214.98
7.3.330.0060.00013.22
7.3.320.0000.00713.25
7.3.310.0030.00316.43
7.3.300.0060.00016.31
7.3.290.0040.00416.48
7.3.280.0120.00516.44
7.3.270.0130.00817.40
7.3.260.0090.00916.45
7.3.250.0120.00816.54
7.3.240.0130.00616.49
7.3.230.0160.00716.40
7.3.210.0090.00916.53
7.3.200.0190.00019.39
7.3.190.0060.01116.59
7.3.180.0170.00716.60
7.3.170.0100.01316.57
7.3.160.0040.01316.41
7.2.330.0040.01516.74
7.2.320.0040.01816.84
7.2.310.0030.01716.70
7.2.300.0040.01416.54
7.2.290.0120.00616.89
7.2.60.0090.00617.02
7.2.00.0090.00319.54
7.1.200.0030.01115.86
7.1.100.0090.00618.19
7.1.70.0040.00417.11
7.1.60.0100.01620.03
7.1.50.0030.01317.11
7.1.00.0070.07022.42
7.0.200.0350.00614.97
7.0.60.0170.05319.99
7.0.50.0070.05717.93
7.0.40.0100.04020.30
7.0.30.0230.03720.27
7.0.20.0270.06320.26
7.0.10.0030.05720.16
7.0.00.0100.07320.06
5.6.280.0030.06320.91
5.6.210.0030.06020.54
5.6.200.0070.04718.16
5.6.190.0170.05320.55
5.6.180.0430.04320.66
5.6.170.0270.07720.46
5.6.160.0070.06720.48
5.6.150.0030.05718.18
5.6.140.0100.03318.28
5.6.130.0030.04718.11
5.6.120.0030.04321.06
5.6.110.0070.04721.16
5.6.100.0000.04321.04
5.6.90.0070.08320.97
5.6.80.0130.07020.52
5.5.350.0070.04320.45
5.5.340.0100.04018.06
5.5.330.0030.08320.21
5.5.320.0030.05020.38
5.5.310.0230.07320.34
5.5.300.0100.03718.02
5.5.290.0100.08017.95
5.5.280.0200.04320.70
5.5.270.0170.07320.87
5.5.260.0130.08020.85
5.5.250.0130.08020.68
5.5.240.0030.04020.17
5.4.450.0830.05719.48
5.4.440.0630.07319.20
5.4.430.0600.06319.60
5.4.420.0330.06019.30
5.4.410.0170.05019.57
5.4.400.0600.05719.07
5.4.390.0470.06319.26
5.4.380.1270.07319.26
5.4.370.0600.07719.15
5.4.360.0670.06319.16
5.4.350.0870.05319.23
5.4.340.0800.06319.31
5.4.320.0800.06319.23
5.4.310.0770.05019.26
5.4.300.1100.07018.98
5.4.290.0930.06319.30
5.4.280.0800.06319.01
5.4.270.0900.04719.29
5.4.260.0730.05719.28
5.4.250.0770.06019.25
5.4.240.0870.06319.25
5.4.230.0700.05719.25
5.4.220.0570.06319.31
5.4.210.0700.06019.06
5.4.200.0600.05316.88
5.4.190.0900.06019.04
5.4.180.1000.04718.84
5.4.170.0800.06718.98
5.4.160.0800.04718.93
5.4.150.0830.05318.96
5.4.140.1330.05716.49
5.4.130.0970.05016.40
5.4.120.0870.05316.41
5.4.110.0830.06016.48
5.4.100.0730.04716.39
5.4.90.0770.06316.51
5.4.80.1000.06316.26
5.4.70.1030.05016.27
5.4.60.0300.05716.44
5.4.50.0030.07316.56
5.4.40.0230.06716.54
5.4.30.0200.04716.43
5.4.20.0200.05716.54
5.4.10.0200.04716.43

preferences:
68.13 ms | 401 KiB | 5 Q