3v4l.org

run code in 300+ PHP versions simultaneously
<?php // String manipulation (explode and manual comparison) $sstart = microtime(true); for ($i = 0; $i < 100000; $i++) { $uri = 'user/123'; $segments = explode('/', $uri); if ($segments[0] === 'user' && is_numeric($segments[1])) { $id = $segments[1]; } } $string = (microtime(true) - $sstart); echo 'String manipulation: ' . $string . ' seconds'.PHP_EOL; // Regex equivalent $rstart = microtime(true); for ($i = 0; $i < 100000; $i++) { $uri = 'user/123'; if (preg_match('#^user/(\d+)$#', $uri, $matches)) { $id = $matches[1]; } } $regex = (microtime(true) - $rstart); echo 'Regex: ' . $regex . ' seconds'.PHP_EOL; echo 'Diff: '.((($regex - $string) / $string) * 100).'%';

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.110.0340.04516.44
8.3.100.0290.05416.56
8.3.90.0150.02416.62
8.3.80.0180.02616.50
8.3.70.0240.02716.63
8.3.60.0250.02516.38
8.3.50.0360.03316.75
8.3.40.0230.02317.75
8.3.30.0260.05417.38
8.3.20.0150.05717.50
8.3.10.0260.03617.50
8.3.00.0130.05017.59
8.2.230.0240.05116.27
8.2.220.0360.02916.27
8.2.210.0230.04316.80
8.2.200.0270.03716.75
8.2.190.0200.02016.50
8.2.180.0150.02216.77
8.2.170.0170.05417.63
8.2.160.0220.02217.63
8.2.150.0280.03817.85
8.2.140.0170.02317.63
8.2.130.0300.05317.59
8.2.120.0370.03717.86
8.2.110.0320.04617.63
8.2.100.0150.02217.88
8.2.90.0290.02317.75
8.2.80.0220.02817.50
8.2.70.0180.02117.63
8.2.60.0210.01717.63
8.2.50.0220.05117.50
8.2.40.0190.02817.88
8.2.30.0200.02017.60
8.2.20.0240.03417.37
8.2.10.0160.02817.50
8.2.00.0380.03217.50
8.1.290.0230.02316.25
8.1.280.0160.02016.00
8.1.270.0130.03017.41
8.1.260.0330.05017.36
8.1.250.0160.02417.48
8.1.240.0130.02217.12
8.1.230.0340.04016.98
8.1.220.0280.05017.10
8.1.210.0400.04017.13
8.1.200.0180.02716.86
8.1.190.0290.03616.88
8.1.180.0120.02317.10
8.1.170.0110.02517.35
8.1.160.0180.04316.98
8.1.150.0140.02217.34
8.1.140.0180.05317.10
8.1.130.0190.01617.35
8.1.120.0140.02017.34
8.1.110.0190.01617.34
8.1.100.0160.01917.47
8.1.90.0130.02317.00
8.1.80.0160.01917.59
8.1.70.0140.02117.23
8.1.60.0250.05017.50
8.1.50.0210.06017.38
8.1.40.0210.01817.50
8.1.30.0140.04617.35
8.1.20.0100.02817.85
8.1.10.0210.01817.47
8.1.00.0260.04617.38

preferences:
24.04 ms | 403 KiB | 5 Q