3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ 'A number at the end 1357', '2368 Letters and spaces 8675309', ]; foreach ($strings as $string) { var_export([ 'strcspn' => strcspn($string, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '), //reduces to 'a..zA..Z ' 'strspn' => strspn($string, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '), //reduces to 'a..zA..Z ' 'strpbrk' => strpbrk($string, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '), //reduces to 'a..zA..Z ' 'strtok' => strtok($string, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '), //reduces to 'a..zA..Z ' 'strtok2' => strtok('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '), //reduces to 'a..zA..Z ' ]); echo "\n--\n"; }

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.4.120.0140.00622.38
8.4.110.0130.00722.34
8.4.100.0120.00917.84
8.4.90.0070.00518.74
8.4.80.0130.00818.00
8.4.70.0100.01018.04
8.4.60.0110.00918.78
8.4.50.0140.00817.79
8.4.40.0040.01119.36
8.4.30.0110.00720.52
8.4.20.0100.01017.74
8.4.10.0080.00022.32
8.3.250.0090.01018.86
8.3.240.0140.00416.73
8.3.230.0120.00916.51
8.3.220.0090.01017.07
8.3.210.0110.00916.48
8.3.200.0050.00416.53
8.3.190.0080.01217.24
8.3.180.0090.00816.54
8.3.170.0040.01418.64
8.3.160.0120.00618.33
8.3.150.0070.00717.36
8.3.140.0040.00419.22
8.3.130.0070.00718.31
8.3.120.0050.00519.07
8.3.110.0000.01120.94
8.3.100.0060.00324.06
8.3.90.0120.00626.77
8.3.80.0040.00418.43
8.3.70.0070.01116.58
8.3.60.0030.01218.31
8.3.50.0130.00320.16
8.3.40.0100.00321.86
8.3.30.0030.01218.71
8.3.20.0070.00024.18
8.3.10.0050.00324.66
8.3.00.0000.00826.16
8.2.290.0070.01120.31
8.2.280.0120.00418.44
8.2.270.0110.00718.94
8.2.260.0070.01118.57
8.2.250.0000.00816.83
8.2.240.0050.00318.97
8.2.230.0080.00022.58
8.2.220.0060.00337.54
8.2.210.0040.00426.77
8.2.200.0100.00016.75
8.2.190.0040.01116.58
8.2.180.0040.01125.92
8.2.170.0030.01318.94
8.2.160.0110.00622.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00720.79
8.2.110.0060.00319.21
8.2.100.0070.00417.84
8.2.90.0000.00817.88
8.2.80.0000.00817.97
8.2.70.0000.00817.68
8.2.60.0000.00818.04
8.2.50.0040.00418.07
8.2.40.0030.00618.28
8.2.30.0050.00318.15
8.2.20.0030.00320.37
8.2.10.0040.00418.07
8.2.00.0000.00719.32
8.1.330.0080.00622.00
8.1.320.0130.00816.30
8.1.310.0120.00316.23
8.1.300.0040.01119.98
8.1.290.0060.00330.84
8.1.280.0140.00725.92
8.1.270.0030.00523.99
8.1.260.0150.00326.35
8.1.250.0080.00028.09
8.1.240.0090.00021.43
8.1.230.0130.00022.74
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0030.00617.25
8.1.190.0050.00317.23
8.1.180.0080.00018.10
8.1.170.0050.00318.46
8.1.160.0070.00018.90
8.1.150.0080.00018.69
8.1.140.0040.00417.51
8.1.130.0000.00717.49
8.1.120.0040.00317.46
8.1.110.0000.00817.50
8.1.100.0020.00517.52
8.1.90.0000.00817.43
8.1.80.0080.00417.43
8.1.70.0100.00517.39
8.1.60.0100.00717.52
8.1.50.0130.00317.41
8.1.40.0040.01317.42
8.1.30.0120.00417.62
8.1.20.0180.00017.62
8.1.10.0120.00617.48
8.1.00.0120.00617.37
8.0.300.0050.00319.87
8.0.290.0050.00216.63
8.0.280.0030.00518.36
8.0.270.0000.00718.08
8.0.260.0030.00316.84
8.0.250.0070.00016.98
8.0.240.0050.00316.90
8.0.230.0030.00316.95
8.0.220.0000.00716.84
8.0.210.0030.01216.76
8.0.200.0150.00016.91
8.0.190.0140.00016.83
8.0.180.0130.00316.88
8.0.170.0070.00716.89
8.0.160.0100.00516.83
8.0.150.0100.00316.71
8.0.140.0110.00416.70
8.0.130.0080.00816.64
8.0.120.0150.00016.88
8.0.110.0070.00716.88
8.0.100.0140.00016.75
8.0.90.0110.00316.80
8.0.80.0090.00516.85
8.0.70.0110.00016.84
8.0.60.0000.00916.78
8.0.50.0120.00416.79
8.0.30.0120.00416.79
8.0.20.0130.00316.87
8.0.10.0050.01016.86
7.4.330.0050.00015.55
7.4.320.0060.00016.47
7.4.300.0110.00416.37
7.4.290.0120.00316.53
7.4.280.0150.00216.53
7.4.270.0070.00716.49
7.4.260.0110.00416.63
7.4.250.0130.00416.47
7.4.240.0120.00416.59
7.4.230.0140.00016.45
7.4.220.0070.00416.38
7.4.210.0030.01016.57
7.4.200.0110.00316.52
7.4.190.0100.00516.66
7.4.180.0110.00316.62
7.4.160.0100.00516.61
7.4.150.0110.00016.55
7.4.140.0040.00716.34
7.4.130.0130.00016.49
7.4.120.0060.00316.45
7.4.110.0030.00616.16
7.4.100.0030.00616.25
7.4.90.0120.00016.35
7.4.80.0110.00016.43
7.4.70.0080.00316.02
7.4.60.0000.00916.52
7.4.50.0050.00516.09
7.4.40.0100.00016.17
7.4.30.0100.00016.36
7.4.20.0100.00316.42
7.4.10.0100.00516.24
7.4.00.0120.00316.34

preferences:
29.86 ms | 403 KiB | 5 Q