3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str2int_mask(string $flags, string $strmask): int { $bitmask = 0; for($i = 0; $i < strlen($strmask); $i++){ if(strpos($flags, $strmask[$i]) === FALSE){ throw new invalidOptionException(); } $bitmask += 2 ** strpos($flags, $strmask[$i]); } return $bitmask; } function int2str_mask(string $flags, int $bitmask): str { $strmask = ''; for($i = 0; $bitmask > 0; $i++){ if($bitmask & 1){ $strmask .= $flags[$i]; } $bitmask = $bitmask >> 1; } return $strmask; } var_dump(str2int_mask('abcd', 'dba'));

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.5.10.0100.00916.84
8.5.00.0140.01120.20
8.4.160.0090.01425.67
8.4.150.0020.00014.05
8.4.140.0120.00918.00
8.4.130.0110.00917.72
8.4.120.0080.01122.25
8.4.110.0110.00922.34
8.4.100.0090.01017.75
8.4.90.0120.00917.67
8.4.80.0130.00617.95
8.4.70.0030.00519.29
8.4.60.0090.01319.41
8.4.50.0140.00722.56
8.4.40.0130.00719.43
8.4.30.0130.00619.37
8.4.20.0070.01319.65
8.4.10.0080.00819.25
8.3.280.0120.00818.51
8.3.270.0110.00916.69
8.3.260.0080.01316.66
8.3.250.0090.00718.96
8.3.240.0110.00916.57
8.3.230.0120.00716.43
8.3.220.0130.00517.47
8.3.210.0120.00616.84
8.3.200.0130.00616.71
8.3.190.0120.00716.44
8.3.180.0110.00816.36
8.3.170.0150.00318.83
8.3.160.0150.00416.76
8.3.150.0040.00418.98
8.3.140.0000.00816.73
8.3.130.0030.01716.73
8.3.120.0150.00418.91
8.3.110.0130.00320.94
8.3.100.0110.00024.06
8.3.90.0150.00326.77
8.3.80.0040.00718.30
8.3.70.0140.00416.50
8.3.60.0110.01118.55
8.3.50.0060.00817.58
8.3.40.0070.00718.86
8.3.30.0130.00318.85
8.3.20.0070.00021.81
8.3.10.0040.00423.71
8.3.00.0040.00421.97
8.2.290.0080.00320.48
8.2.280.0060.00718.63
8.2.270.0100.01017.04
8.2.260.0120.00916.62
8.2.250.0000.00816.65
8.2.240.0040.00417.15
8.2.230.0050.00322.58
8.2.220.0100.00037.54
8.2.210.0030.00526.77
8.2.200.0000.01016.75
8.2.190.0070.00716.63
8.2.180.0060.00918.31
8.2.170.0110.00722.96
8.2.160.0100.01020.14
8.2.150.0080.00024.18
8.2.140.0030.00524.66
8.2.130.0040.00420.92
8.2.120.0040.00426.35
8.2.110.0070.00322.08
8.2.100.0040.00819.03
8.2.90.0030.00617.88
8.2.80.0060.00617.97
8.2.70.0080.00018.04
8.2.60.0050.00318.22
8.2.50.0000.00718.16
8.2.40.0000.00720.59
8.2.30.0040.00422.28
8.2.20.0040.00418.19
8.2.10.0040.00418.19
8.2.00.0040.00417.95
8.1.330.0080.01116.89
8.1.320.0150.00616.19
8.1.310.0060.00918.17
8.1.300.0030.00618.35
8.1.290.0000.00918.88
8.1.280.0120.00425.92
8.1.270.0040.00422.19
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00323.83
8.1.230.0060.00619.04
8.1.220.0040.00417.79
8.1.210.0050.00318.77
8.1.200.0080.00017.13
8.1.190.0080.00017.23
8.1.180.0050.00318.10
8.1.170.0040.00418.51
8.1.160.0040.00418.97
8.1.150.0070.00020.23
8.1.140.0050.00317.65
8.1.130.0030.00318.96
8.1.120.0040.00417.42
8.1.110.0000.00717.28
8.1.100.0070.00017.32
8.1.90.0040.00417.30
8.1.80.0030.00517.30
8.1.70.0060.00317.35
8.1.60.0030.00517.58
8.1.50.0030.00517.43
8.1.40.0040.00417.53
8.1.30.0000.00817.52
8.1.20.0070.00417.75
8.1.10.0000.00817.56
8.1.00.0030.00517.41
8.0.300.0000.00819.60
8.0.290.0030.00616.75
8.0.280.0000.00718.33
8.0.270.0070.00017.19
8.0.260.0060.00316.87
8.0.250.0000.00716.94
8.0.240.0000.00816.98
8.0.230.0030.00316.95
8.0.220.0000.00816.85
8.0.210.0030.00316.84
8.0.200.0030.00316.98
8.0.190.0040.00416.82
8.0.180.0000.00716.97
8.0.170.0040.00416.93
8.0.160.0070.00016.99
8.0.150.0000.00716.82
8.0.140.0030.00516.78
8.0.130.0060.00013.25
8.0.120.0020.00516.81
8.0.110.0000.00716.82
8.0.100.0000.00716.66
8.0.90.0040.00416.67
8.0.80.0040.01116.81
8.0.70.0040.00416.88
8.0.60.0070.00016.79
8.0.50.0080.00016.72
8.0.30.0080.00917.20
8.0.20.0030.01517.40
8.0.10.0040.00416.77
8.0.00.0120.00616.71
7.4.330.0000.00615.55
7.4.320.0000.00716.63
7.4.300.0030.00316.48
7.4.290.0000.00716.64
7.4.280.0050.00516.52
7.4.270.0030.00316.50
7.4.260.0000.00916.61
7.4.250.0000.00716.54
7.4.240.0040.00416.52
7.4.230.0070.00016.66
7.4.220.0000.00816.41
7.4.210.0060.00916.69
7.4.200.0080.00016.62
7.4.160.0070.00916.57
7.4.140.0100.01317.86
7.4.130.0090.00916.39
7.4.120.0100.00916.53
7.3.330.0060.00013.37
7.3.320.0050.00013.38
7.3.310.0070.00016.19
7.3.300.0000.00716.32
7.3.290.0070.00716.36
7.3.280.0110.00816.39
7.3.260.0090.01016.44
7.3.240.0130.00816.43
7.2.30.0100.01520.05

preferences:
39.14 ms | 403 KiB | 5 Q