3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ 'this is a test! this is a test! this is a test! this is a test! this is a test! cmyk derp.png', ' this is a test! this is a test! this is a test! this is a test! this is a test! cmyk x.png ', ' this is a test! this is a test! this is a test! this is a test! this is a test! cmykx .png ', ' this is a test! this is a test! this is a test! this is a test! this is a test! derpderp .png ', ' this is a test! this is a test! this is a test! this is a test! this is a test! derpd .png ', ' this is a test! this is a test! this is a test! this is a test! this is a test! derp .png ', ' this is a test! this is a test! this is a test! this is a test! this is a test.png ', 'this is a test! this is a test! this is a test! this is a test! this is a - - - - - - test.png', 'this is a test! this is a test! this is a test! this is a test! this is a test! this is a test! this is a test! .png', 'this is a test! this is a test! this is a test! this is a test! this is a test! thisx is a test! this is a test! .png', 'this is a test! this is a test! this is a test! this is a test! this is a test! thisxy is a test! this is a test! .png', ]; foreach ( $tests as $originalFilename) { $filteredFilename = str_replace(' ', '-', strtolower(trim($originalFilename))); $filteredFilename = substr( $filteredFilename, 0, strrpos($filteredFilename,'.') ); $filteredFilename = preg_replace('/(\bcmyk\b)|([^a-z0-9\-]+)|(\-+$)/','',$filteredFilename); $filteredFilename = preg_replace('/-{2,}/','-',$filteredFilename); $filteredFilenameLength = strlen($filteredFilename); if ( $filteredFilenameLength > 80 ) { if ($filteredFilename[80] === '-') { echo 'case 1', PHP_EOL; $filteredFilename = substr($filteredFilename, 0, 80); } else { echo 'case 2', PHP_EOL; $filteredFilename = substr($filteredFilename, 0, strrpos($filteredFilename, '-', 80 - $filteredFilenameLength)); } } else { echo 'case 3', PHP_EOL; } echo $filteredFilenameLength, ' ', strlen($filteredFilename), ' ', $filteredFilename, 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.01017.00
8.3.50.0110.00416.52
8.3.40.0200.00318.96
8.3.30.0000.01518.83
8.3.20.0040.00421.87
8.3.10.0040.00423.41
8.3.00.0030.00519.85
8.2.180.0140.00717.00
8.2.170.0090.01222.96
8.2.160.0100.01020.53
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00420.43
8.2.120.0000.01826.35
8.2.110.0100.00020.39
8.2.100.0090.00318.22
8.2.90.0080.00019.39
8.2.80.0090.00017.97
8.2.70.0000.00817.75
8.2.60.0030.00517.93
8.2.50.0000.00818.10
8.2.40.0050.00320.64
8.2.30.0040.00421.05
8.2.20.0030.00618.27
8.2.10.0000.00818.17
8.2.00.0070.00318.16
8.1.280.0150.00025.92
8.1.270.0050.00322.20
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00320.95
8.1.230.0040.00817.76
8.1.220.0040.00517.74
8.1.210.0000.00818.77
8.1.200.0100.00017.50
8.1.190.0040.00417.47
8.1.180.0040.00418.10
8.1.170.0050.00318.63
8.1.160.0050.00218.92
8.1.150.0040.00420.34
8.1.140.0040.00419.50
8.1.130.0050.00518.83
8.1.120.0070.00017.63
8.1.110.0030.00517.48
8.1.100.0000.00817.54
8.1.90.0000.00817.66
8.1.80.0040.00417.54
8.1.70.0000.00717.53
8.1.60.0000.00817.81
8.1.50.0070.00017.53
8.1.40.0000.00817.61
8.1.30.0030.00617.72
8.1.20.0030.00617.66
8.1.10.0030.00517.73
8.1.00.0040.00417.69
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0000.00818.39
8.0.270.0040.00417.22
8.0.260.0070.00016.86
8.0.250.0000.00717.14
8.0.240.0040.00417.13
8.0.230.0050.00217.16
8.0.220.0030.00317.06
8.0.210.0040.00416.95
8.0.200.0000.00717.02
8.0.190.0030.00616.99
8.0.180.0040.00417.07
8.0.170.0050.00217.13
8.0.160.0030.00617.05
8.0.150.0030.00617.09
8.0.140.0050.00517.09
8.0.130.0050.00013.37
8.0.120.0030.00516.94
8.0.110.0050.00217.04
8.0.100.0000.00817.05
8.0.90.0050.00316.98
8.0.80.0090.01217.02
8.0.70.0000.00717.03
8.0.60.0000.00717.01
8.0.50.0050.00317.13
8.0.30.0080.01017.33
8.0.20.0130.01017.40
8.0.10.0050.00317.28
8.0.00.0120.00916.74
7.4.330.0050.00315.55
7.4.320.0000.00616.86
7.4.300.0030.00316.81
7.4.290.0030.00716.71
7.4.280.0040.00416.87
7.4.270.0030.00316.76
7.4.260.0000.00716.83
7.4.250.0040.00416.63
7.4.240.0050.00316.65
7.4.230.0030.00516.77
7.4.220.0310.00816.86
7.4.210.0150.00016.76
7.4.200.0070.00016.64
7.4.160.0050.01116.85
7.4.150.0100.00717.40
7.4.140.0120.01017.86
7.4.130.0060.01916.68
7.4.120.0080.01116.62
7.4.110.0120.00616.76
7.4.100.0130.00716.79
7.4.90.0120.00616.68
7.4.80.0190.00019.39
7.4.70.0000.01716.67
7.4.60.0030.01216.79
7.4.50.0000.01416.61
7.4.40.0130.00616.86
7.4.30.0090.00916.68
7.4.00.0090.00715.11
7.3.330.0060.00013.37
7.3.320.0050.00013.23
7.3.310.0000.00716.43
7.3.300.0070.00016.53
7.3.290.0070.00916.54
7.3.280.0080.00916.49
7.3.270.0160.00717.40
7.3.260.0140.00516.66
7.3.250.0120.00616.75
7.3.240.0120.00616.86
7.3.230.0040.01416.83
7.3.210.0090.00916.57
7.3.200.0080.00816.83
7.3.190.0160.00016.88
7.3.180.0060.01516.49
7.3.170.0080.01116.54
7.3.160.0110.00716.69
7.3.120.0050.01114.90
7.3.110.0120.00314.95
7.3.100.0080.00615.15
7.3.90.0100.00615.13
7.3.80.0050.01115.10
7.3.70.0020.01514.88
7.3.60.0070.00815.04
7.3.50.0030.00915.04
7.3.40.0070.00715.01
7.3.30.0080.00315.05
7.3.20.0030.00916.91
7.3.10.0090.00416.82
7.3.00.0070.00716.84
7.2.330.0110.00917.00
7.2.320.0150.00916.86
7.2.310.0110.01116.90
7.2.300.0060.01617.00
7.2.290.0080.00816.90
7.2.250.0080.01215.29
7.2.240.0080.01015.22
7.2.230.0090.00715.11
7.2.220.0110.00315.20
7.2.210.0070.00715.21
7.2.200.0020.00915.09
7.2.190.0050.00815.20
7.2.180.0090.00715.32
7.2.170.0020.01315.36
7.2.160.0070.01015.18
7.2.150.0030.01317.31
7.2.140.0060.00616.89
7.2.130.0060.00917.09
7.2.120.0090.00916.84
7.2.110.0110.00416.82
7.2.100.0060.00617.06
7.2.90.0090.00917.00
7.2.80.0100.00717.10
7.2.70.0030.01017.10
7.2.60.0050.01117.16
7.2.50.0090.00416.91
7.2.40.0100.00717.28
7.2.30.0100.00716.99
7.2.20.0070.01117.12
7.2.10.0030.00916.95
7.2.00.0100.00617.11
7.1.330.0030.01316.06
7.1.320.0030.01216.12
7.1.310.0080.00815.90
7.1.300.0060.00715.84
7.1.290.0080.00816.02
7.1.280.0050.01016.02
7.1.270.0060.00815.87
7.1.260.0060.00816.02
7.1.250.0070.01015.88
7.1.200.0030.01015.99
7.1.70.0030.00617.57
7.1.60.0230.01733.63
7.1.50.2170.02033.12
7.1.40.0130.02033.07
7.1.30.0330.01332.87
7.1.20.0300.00733.14
7.1.10.1370.01015.09
7.1.00.2270.02015.36
7.0.200.0130.01015.00
7.0.190.1900.01315.02
7.0.180.0900.01014.62
7.0.170.0070.01014.60
7.0.160.2030.01314.65
7.0.150.0070.00714.61
7.0.140.0470.01714.70
7.0.130.1930.01314.89
7.0.120.2070.01014.96
7.0.110.1200.02014.75
7.0.100.1170.01714.53
7.0.90.2030.01014.70
7.0.80.1900.01314.98
7.0.70.1100.01014.68
7.0.60.1030.01014.69
7.0.50.1100.01014.85
7.0.40.1000.00715.04
7.0.30.1000.01014.94
7.0.20.1200.02014.60
7.0.10.1130.01014.91
7.0.00.0930.01014.88

preferences:
39.9 ms | 401 KiB | 5 Q