3v4l.org

run code in 300+ PHP versions simultaneously
<?php for( $i = 0 ; $i < 100000 ; $i++ ) { $ARR[$i] = sprintf('%08X', $i); } // lower(STRSPN) on a string $start = microtime(true); for( $i = 0 ; $i < 100000 ; $i++ ) { strlen($ARR[$i]) != strspn(strtolower($ARR[$i]), '0123456789abcdef'); } $crc = microtime(true) - $start; printf("%-11s %0.2f\n", "STRSPN+l", $crc); unset($ARX); // STRSPN on a string $start = microtime(true); for( $i = 0 ; $i < 100000 ; $i++ ) { strlen($ARR[$i]) != strspn($ARR[$i], '0123456789ABCDEFabcdef'); } $crc = microtime(true) - $start; printf("%-11s %0.2f\n", "STRSPN", $crc); unset($ARX); // PREG_MATCH on a string $start = microtime(true); for( $i = 0 ; $i < 100000 ; $i++ ) { preg_match('#[^0-9a-f]#i', $ARR[$i], $_s); } $crc = microtime(true) - $start; printf("%-11s %0.2f\n", "PREG_MATCH", $crc); unset($ARX);

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)
7.3.120.0340.05848.63
7.3.110.0200.07548.86
7.3.100.0200.07248.67
7.3.90.0270.06548.65
7.3.80.0260.06548.64
7.3.70.0170.07048.53
7.3.60.0130.07348.58
7.3.50.0200.06948.74
7.3.40.0170.08448.65
7.3.30.0200.07748.74
7.3.20.0070.06650.71
7.3.10.0140.06550.64
7.3.00.0130.06350.50
7.2.240.0230.07848.68
7.2.230.0100.08748.54
7.2.220.0160.08148.75
7.2.210.0160.08248.87
7.2.200.0130.08748.86
7.2.190.0200.09248.90
7.2.180.0200.07849.03
7.2.170.0200.07448.69
7.2.160.0230.07248.81
7.2.150.0070.07850.91
7.2.140.0100.07950.88
7.2.130.0100.08050.45
7.2.120.0100.07350.75
7.2.110.0200.06650.58
7.2.100.0070.07450.87
7.2.90.0070.07850.52
7.2.80.0200.06350.83
7.2.70.0070.07950.77
7.2.60.0060.07850.93
7.2.50.0130.07250.82
7.2.40.0170.07650.62
7.2.30.0100.07650.88
7.2.20.0100.08550.60
7.2.10.0100.08050.62
7.2.00.0110.05951.99
7.1.330.0100.11549.79
7.1.320.0130.11149.83
7.1.310.0070.12149.69
7.1.300.0000.12449.65
7.1.290.0100.11249.84
7.1.280.0130.10649.66
7.1.270.0070.11449.84
7.1.260.0030.13149.52
7.1.250.0100.12149.64
7.1.70.0070.05751.41
7.1.60.0300.07451.27
7.1.50.0170.09250.85
7.1.00.0230.14056.28
7.0.200.0460.07950.84
7.0.100.0700.16053.48
7.0.90.0970.14053.38
7.0.80.0430.14753.34
7.0.70.1200.13353.39
7.0.60.1130.13353.52
7.0.50.0730.14753.82
7.0.40.0270.13723.89
7.0.30.0400.16323.82
7.0.20.0230.15323.92
7.0.10.0170.13323.93
7.0.00.0430.16323.95
5.6.280.0070.27359.82
5.6.250.0130.25059.32
5.6.240.0270.23059.43
5.6.230.0270.22759.29
5.6.220.0300.21059.50
5.6.210.0100.25359.28
5.6.200.0300.23359.77
5.6.190.0200.24759.75
5.6.180.0170.26759.88
5.6.170.0130.26059.74
5.6.160.0200.23759.83
5.6.150.0200.26359.75
5.6.140.0170.25359.81
5.6.130.0200.21759.75
5.6.120.0170.21759.77
5.6.110.0270.25359.81
5.6.100.0130.26059.81
5.6.90.0270.21359.71
5.6.80.0200.23359.29
5.6.70.0100.20759.21
5.6.60.0230.25059.28
5.6.50.0200.29059.23
5.6.40.0130.24759.16
5.6.30.0100.23359.20
5.6.20.0100.21759.18
5.6.10.0200.26759.11
5.6.00.0170.26059.18
5.5.380.0300.23059.34
5.5.370.0200.25059.21
5.5.360.0200.22759.21
5.5.350.0230.22759.21
5.5.340.0300.24359.66
5.5.330.0230.23759.70
5.5.320.0370.25759.64
5.5.310.0130.26059.69
5.5.300.0230.28059.62
5.5.290.0200.25359.43
5.5.280.0230.22759.57
5.5.270.0130.23059.60
5.5.260.0170.28359.51
5.5.250.0100.23059.51
5.5.240.0070.25359.02
5.5.230.0170.25358.91
5.5.220.0300.23058.93
5.5.210.0230.21758.98
5.5.200.0130.27059.01
5.5.190.0130.29358.95
5.5.180.0130.23059.05
5.5.160.0200.22059.02
5.5.150.0270.20059.01
5.5.140.0170.21759.01
5.5.130.0030.22358.97
5.5.120.0000.25358.93
5.5.110.0230.16059.03
5.5.100.0130.23058.77
5.5.90.0100.20058.95
5.5.80.0230.16358.91
5.5.70.0170.19758.77
5.5.60.0170.20058.89
5.5.50.0070.21358.90
5.5.40.0130.20058.90
5.5.30.0330.18058.90
5.5.20.0100.18358.89
5.5.10.0230.22758.88
5.5.00.0200.24058.84
5.4.450.0730.23058.11
5.4.440.0330.21058.10
5.4.430.0070.20758.12
5.4.420.0100.22058.10
5.4.410.0130.24757.75
5.4.400.0200.21057.69
5.4.390.0270.22757.79
5.4.380.0230.23057.75
5.4.370.0300.24057.74
5.4.360.0270.24057.78
5.4.350.0170.20757.63
5.4.340.0330.23757.89
5.4.320.0070.25357.78
5.4.310.0170.26757.80
5.4.300.0130.19357.70
5.4.290.0230.18357.55
5.4.280.0170.19757.85
5.4.270.0070.20057.56
5.4.260.0200.20757.55
5.4.250.0070.25057.88
5.4.240.0100.20057.82
5.4.230.0230.18357.75
5.4.220.0200.24757.81
5.4.210.0170.19357.60
5.4.200.0200.18757.78
5.4.190.0100.19057.73
5.4.180.0230.18757.51
5.4.170.0230.19057.55
5.4.160.0270.23757.71
5.4.150.0170.23057.83
5.4.140.0030.25754.98
5.4.130.0170.19055.10
5.4.120.0230.26055.09
5.4.110.0200.24055.10
5.4.100.0170.24054.90
5.4.90.0200.22355.03
5.4.80.0130.26355.11
5.4.70.0170.24355.02
5.4.60.0230.24755.11
5.4.50.0170.25755.01
5.4.40.0130.21355.03
5.4.30.0100.23355.02
5.4.20.0130.23055.18
5.4.10.0170.27354.91
5.4.00.0270.24754.54
5.3.290.0200.26052.75
5.3.280.0030.19752.73
5.3.270.0100.23752.64
5.3.260.0170.29352.73
5.3.250.0270.23352.60
5.3.240.0370.26752.56
5.3.230.0130.27752.73
5.3.220.0130.34752.60
5.3.210.0170.25752.63
5.3.200.0270.26052.69
5.3.190.0070.28052.64
5.3.180.0200.27352.65
5.3.170.0170.22752.49
5.3.160.0170.25752.68
5.3.150.0300.25352.67
5.3.140.0230.27752.64
5.3.130.0170.22752.62
5.3.120.0130.23353.06
5.3.110.0230.25352.68
5.3.100.0270.30352.07
5.3.90.0170.28051.95
5.3.80.0200.27751.98
5.3.70.0170.23052.04
5.3.60.0100.30052.07
5.3.50.0170.27051.96
5.3.40.0230.28751.97
5.3.30.0200.29351.89
5.3.20.0230.29751.71
5.3.10.0130.27751.70
5.3.00.0130.27751.71
5.2.170.0170.29048.37
5.2.160.0230.28348.43
5.2.150.0170.23348.37
5.2.140.0200.27048.39
5.2.130.0400.20748.40
5.2.120.0130.28348.39
5.2.110.0270.22348.31
5.2.100.0170.28348.46
5.2.90.0170.26048.57
5.2.80.0130.24048.45
5.2.70.0270.26348.30
5.2.60.0230.28048.20
5.2.50.0100.32048.36
5.2.40.0300.27048.37
5.2.30.0270.30048.31
5.2.20.0170.26048.44
5.2.10.0070.27348.17
5.2.00.0130.25348.12
5.1.60.0100.25053.51
5.1.50.0300.25053.45
5.1.40.0170.25053.57
5.1.30.0130.28353.86
5.1.20.0270.25053.93
5.1.10.0170.29353.45
5.1.00.0270.25353.56
5.0.50.0170.37052.14
5.0.40.0070.35051.77
5.0.30.0230.34751.74
5.0.20.0030.35351.73
5.0.10.0230.30751.63
5.0.00.0200.37751.76
4.4.90.0130.33727.91
4.4.80.0100.34327.91
4.4.70.0130.33728.05
4.4.60.0200.31027.94
4.4.50.0130.36028.05
4.4.40.0130.33028.07
4.4.30.0070.32027.95
4.4.20.0070.31728.10
4.4.10.0200.35028.07
4.4.00.0130.32328.02
4.3.110.0070.31327.77
4.3.100.0100.32027.84
4.3.90.0200.32327.82
4.3.80.0070.33727.79
4.3.70.0030.34727.90
4.3.60.0200.34027.93
4.3.50.0070.30327.84
4.3.40.0100.32727.89
4.3.30.0000.33726.75
4.3.20.0070.30726.78
4.3.10.0070.31026.72
4.3.00.0100.32726.66

preferences:
46.76 ms | 403 KiB | 5 Q