3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php $regex = '#^/(?<owner>[^/]+)/(?<tournament>[^/]+)/(?<league>[^/]+)/(?<team1>[^/\-]+)\-(?<team1_number>\d+)_(?<team2>[^_\-]+)\-(?<team2_number>\d+)(?:\.(?<_format>html|xml|json))?$#s'; // 0.0165 ms avg $optRegex = '#^/(?<owner>[^/]++)/(?<tournament>[^/]++)/(?<league>[^/]++)/(?<team1>[^/\-]++)\-(?<team1_number>\d++)_(?<team2>[^_\-]++)\-(?<team2_number>\d++)(?:\.(?<_format>html|xml|json))?$#s'; // 0.02 ms avg // only needs 82.5% of the time $totaltime = 0; $matches = array(); for ($i = 0; $i < 1000; $i++) { $t = microtime(true); preg_match($optRegex, '/username/my-tournament', $matches); preg_match($optRegex, '/username/my-tournament/premier-league', $matches); preg_match($optRegex, '/username/my-tournament/premier-league/matches', $matches); preg_match($optRegex, '/username/my-tournament/premier-league/ABC-A_CBA-B', $matches); preg_match($optRegex, '/username/my-tournament/premier-league/ABC-1_CBA-2.pdf', $matches); preg_match($optRegex, '/username/my-tournament/premier-league/ABC-1_CBA-2', $matches); $time = ((microtime(true) - $t) * 1000); $totaltime += $time; } echo sprintf('%.4f ms avg', $totaltime / 1000);

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.210.0120.03912.38
5.4.200.0240.05812.37
5.4.190.0130.04012.37
5.4.180.0110.04212.37
5.4.170.0120.04312.38
5.4.160.0130.04412.38
5.4.150.0130.03912.37
5.4.140.0090.04512.06
5.4.130.0100.04212.04
5.4.120.0120.04112.01
5.4.110.0120.03912.01
5.4.100.0190.04812.00
5.4.90.0100.04312.01
5.4.80.0210.05912.00
5.4.70.0100.04512.00
5.4.60.0110.04112.00
5.4.50.0200.06212.00
5.4.40.0130.04211.99
5.4.30.0160.03911.99
5.4.20.0100.04011.98
5.4.10.0150.03611.98
5.4.00.0130.03911.48
5.3.270.0100.04312.72
5.3.260.0140.03912.72
5.3.250.0110.04312.72
5.3.240.0180.06412.72
5.3.230.0140.04012.71
5.3.220.0100.04412.68
5.3.210.0140.03812.68
5.3.200.0140.04012.68
5.3.190.0130.04112.68
5.3.180.0110.04012.67
5.3.170.0140.04012.67
5.3.160.0090.04312.67
5.3.150.0190.04912.67
5.3.140.0100.04212.66
5.3.130.0120.04212.66
5.3.120.0090.04512.66
5.3.110.0110.04212.66
5.3.100.0120.04212.12
5.3.90.0220.05912.08
5.3.80.0100.04112.08
5.3.70.0100.04112.08
5.3.60.0080.04312.06
5.3.50.0130.03812.00
5.3.40.0100.04012.00
5.3.30.0120.03811.95
5.3.20.0110.03911.72
5.3.10.0100.04011.69
5.3.00.0140.03811.67

preferences:
135.95 ms | 1394 KiB | 7 Q