3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(decode_permissions(4)); //echo encode_permissions(["admin" => FALSE, "employee" => FALSE, "data_entry" => FALSE, "accounting" => FALSE, "hr" => FALSE, "contracts" => FALSE, "sub" => FALSE, "intern" => TRUE]); function encode_permissions($perm) { $levels = ["admin" => 0, "employee" => 1, "data_entry" => 2, "accounting" => 3, "hr" => 4, "contracts" => 5, "sub" => 6, "intern" => 7]; $encoded_perm = 0; foreach($perm as $n => $v) if(array_key_exists($n, $levels) && $v != 'false') $encoded_perm += pow(2,$levels[$n]); return $encoded_perm; } function decode_permissions($perm) { $levels = ["admin", "employee", "data_entry", "accounting", "hr", "contracts", "sub",'intern']; $binary = sprintf( "%0d", decbin( $perm )); return $binary = array_reverse(str_split($binary)); //foreach($levels as $i => $l) $output[$l] = $binary[$i]; //return $output; } ?>

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.0120.00616.63
8.3.50.0100.01021.00
8.3.40.0070.00718.70
8.3.30.0100.00318.92
8.3.20.0040.00420.36
8.3.10.0000.00821.91
8.3.00.0060.00317.38
8.2.180.0070.00718.16
8.2.170.0120.00622.96
8.2.160.0100.00320.39
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0030.00526.16
8.2.120.0040.00419.23
8.2.110.0100.00020.92
8.2.100.0090.00317.84
8.2.90.0060.00317.78
8.2.80.0050.00317.97
8.2.70.0000.00917.50
8.2.60.0030.00618.04
8.2.50.0050.00318.07
8.2.40.0000.00919.88
8.2.30.0040.00418.05
8.2.20.0040.00417.68
8.2.10.0060.00317.97
8.2.00.0070.00018.23
8.1.280.0100.01025.92
8.1.270.0040.00420.40
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0080.00022.57
8.1.230.0000.01020.97
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0030.00917.10
8.1.190.0050.00317.23
8.1.180.0050.00218.10
8.1.170.0060.00320.29
8.1.160.0040.00421.91
8.1.150.0030.00618.89
8.1.140.0030.00617.42
8.1.130.0030.00317.82
8.1.120.0030.00317.36
8.1.110.0000.00817.29
8.1.100.0080.00017.27
8.1.90.0040.00417.36
8.1.80.0040.00417.30
8.1.70.0030.00317.37
8.1.60.0030.00617.66
8.1.50.0000.00817.54
8.1.40.0040.00417.57
8.1.30.0060.00317.55
8.1.20.0070.00017.56
8.1.10.0080.00017.46
8.1.00.0060.00317.29
8.0.300.0000.00719.78
8.0.290.0000.00816.63
8.0.280.0040.00418.43
8.0.270.0000.00717.05
8.0.260.0070.00017.25
8.0.250.0070.00016.87
8.0.240.0040.00416.89
8.0.230.0000.00716.79
8.0.220.0070.00016.75
8.0.210.0060.00316.84
8.0.200.0000.00616.95
8.0.190.0060.00316.92
8.0.180.0000.01016.88
8.0.170.0050.00216.88
8.0.160.0030.00516.71
8.0.150.0070.00016.77
8.0.140.0000.00716.76
8.0.130.0000.00613.23
8.0.120.0040.00416.86
8.0.110.0040.00416.75
8.0.100.0080.00016.70
8.0.90.0000.00716.87
8.0.80.0100.00716.80
8.0.70.0000.00716.95
8.0.60.0050.00216.74
8.0.50.0000.00716.81
8.0.30.0050.01516.93
8.0.20.0120.00917.40
8.0.10.0040.00416.88
8.0.00.0110.01016.71
7.4.330.0000.00515.09
7.4.320.0000.00616.47
7.4.300.0000.00716.60
7.4.290.0030.00616.42
7.4.280.0000.00816.55
7.4.270.0070.00016.44
7.4.260.0080.00016.40
7.4.250.0000.00716.57
7.4.240.0030.00416.63
7.4.230.0030.00316.39
7.4.220.0120.00616.57
7.4.210.0070.01016.57
7.4.200.0070.00016.61
7.4.160.0120.00316.63
7.4.150.0100.01017.40
7.4.140.0120.00717.86
7.4.130.0130.00916.43
7.4.120.0100.01116.47
7.4.110.0140.00316.60
7.4.100.0090.01216.35
7.4.90.0110.00616.55
7.4.80.0140.00319.39
7.4.70.0130.00716.50
7.4.60.0100.00716.57
7.4.50.0000.00516.38
7.4.40.0110.00616.66
7.4.30.0070.01016.61
7.4.00.0090.00614.84
7.3.330.0050.00013.23
7.3.320.0070.00813.38
7.3.310.0050.00316.36
7.3.300.0050.00316.27
7.3.290.0050.00916.28
7.3.280.0130.00416.26
7.3.270.0110.00617.40
7.3.260.0110.00716.46
7.3.250.0100.01216.42
7.3.240.0100.00616.49
7.3.230.0090.01016.39
7.3.210.0140.00316.45
7.3.200.0110.00519.39
7.3.190.0030.01716.38
7.3.180.0060.00916.51
7.3.170.0100.01316.46
7.3.160.0100.00616.54
7.3.120.0070.01115.02
7.3.110.0100.00614.80
7.3.100.0030.01014.72
7.3.90.0110.00314.77
7.3.80.0000.01514.61
7.3.70.0060.00914.97
7.3.60.0060.00914.74
7.3.50.0090.00614.89
7.3.40.0000.01814.51
7.3.30.0000.01614.77
7.3.20.0110.00716.36
7.3.10.0060.01216.34
7.3.00.0070.00716.15
7.2.330.0120.00616.23
7.2.320.0160.00416.73
7.2.310.0060.01316.29
7.2.300.0090.00816.58
7.2.290.0100.01216.36
7.2.240.0070.01015.24
7.2.230.0070.00714.76
7.2.220.0030.01314.95
7.2.210.0090.00614.80
7.2.200.0100.00714.97
7.2.190.0030.01215.08
7.2.180.0040.00915.00
7.2.170.0090.00414.99
7.2.160.0060.00314.70
7.2.150.0060.00916.89
7.2.140.0070.01016.84
7.2.130.0040.00816.51
7.2.120.0000.01816.86
7.2.110.0030.00917.01
7.2.100.0100.00716.72
7.2.90.0110.00416.72
7.2.80.0040.01116.84
7.2.70.0070.01016.96
7.2.60.0070.01016.66
7.2.50.0060.00617.01
7.2.40.0120.00616.81
7.2.30.0070.01116.92
7.2.20.0090.00616.71
7.2.10.0110.00716.60
7.2.00.0060.00917.92
7.1.330.0040.00815.70
7.1.320.0030.00615.92
7.1.310.0070.00715.48
7.1.300.0100.00715.97
7.1.290.0070.01015.82
7.1.280.0060.00815.84
7.1.270.0000.01515.56
7.1.260.0000.01215.62
7.1.250.0070.00715.63
7.1.100.0060.00618.07
7.1.70.0000.01517.15
7.1.60.0090.01619.50
7.1.50.0140.01016.72
7.1.00.0100.07022.28
7.0.200.0030.00516.37
7.0.110.0070.05019.97
7.0.100.0070.05019.91
7.0.90.0070.08020.06
7.0.80.0100.08320.05
7.0.70.0030.08020.02
7.0.60.0070.04720.06
7.0.50.0070.08019.88
7.0.40.0100.08319.71
7.0.30.0130.07319.74
7.0.20.0130.03719.73
7.0.10.0100.07319.64
7.0.00.0130.07719.72
5.6.280.0070.07021.00
5.6.260.0000.04720.74
5.6.250.0000.04320.59
5.6.240.0100.07720.70
5.6.230.0130.07720.48
5.6.220.0100.07020.68
5.6.210.0070.08020.55
5.6.200.0130.07020.71
5.6.190.0070.05020.66
5.6.180.0030.07320.86
5.6.170.0070.04720.62
5.6.160.0130.06720.86
5.6.150.0100.08320.65
5.6.140.0070.04720.56
5.6.130.0130.07320.68
5.6.120.0100.07320.70
5.6.110.0070.06720.70
5.6.100.0000.05320.58
5.6.90.0070.08020.60
5.6.80.0170.06720.10
5.6.70.0100.07019.95
5.6.60.0070.08319.97
5.6.50.0030.08320.03
5.6.40.0030.04020.06
5.6.30.0170.08019.82
5.6.20.0100.08720.00
5.6.10.0070.06020.00
5.6.00.0000.04319.96
5.5.380.0070.07717.55
5.5.370.0070.08017.70
5.5.360.0070.07717.63
5.5.350.0070.06717.64
5.5.340.0130.07318.14
5.5.330.0100.07717.93
5.5.320.0070.08018.13
5.5.310.0100.06718.09
5.5.300.0130.06718.23
5.5.290.0030.08317.91
5.5.280.0070.08018.12
5.5.270.0030.07718.12
5.5.260.0130.03718.25
5.5.250.0070.07717.95
5.5.240.0100.04017.34
5.5.230.0000.06017.34
5.5.220.0170.06717.60
5.5.210.0100.07317.43
5.5.200.0000.08717.44
5.5.190.0030.08317.46
5.5.180.0070.06017.45
5.5.160.0000.07017.41
5.5.150.0070.06717.42
5.5.140.0070.07717.45
5.5.130.0030.06717.18
5.5.120.0130.06717.48
5.5.110.0030.04317.48
5.5.100.0130.04317.16
5.5.90.0070.04017.38
5.5.80.0100.06717.17
5.5.70.0200.05317.07
5.5.60.0030.06017.15
5.5.50.0030.07717.07
5.5.40.0030.07717.20
5.5.30.0130.03317.38
5.5.20.0100.07017.37
5.5.10.0030.07717.34
5.5.00.0100.04017.46
5.4.450.0100.04719.57
5.4.440.0000.05719.44
5.4.430.0030.08019.33
5.4.420.0070.07719.33
5.4.410.0130.09019.19
5.4.400.0070.07319.20
5.4.390.0070.07719.09
5.4.380.0070.07018.98
5.4.370.0070.07719.03
5.4.360.0130.07019.01
5.4.350.0070.07019.04
5.4.340.0030.05319.19
5.4.320.0070.07719.18
5.4.310.0170.06318.98
5.4.300.0000.04018.99
5.4.290.0100.07319.31
5.4.280.0070.04719.23
5.4.270.0000.08318.99
5.4.260.0130.07019.26
5.4.250.0100.06319.02
5.4.240.0030.07318.98
5.4.230.0030.07319.24
5.4.220.0070.07319.08
5.4.210.0000.05319.05
5.4.200.0070.07019.13
5.4.190.0070.07319.19
5.4.180.0000.08019.17
5.4.170.0100.07318.96
5.4.160.0070.07719.24
5.4.150.0200.04019.02
5.4.140.0100.06316.65
5.4.130.0030.04016.60
5.4.120.0170.06016.34
5.4.110.0100.06316.43
5.4.100.0000.04716.52
5.4.90.0100.06716.64
5.4.80.0100.07316.63
5.4.70.0070.07316.65
5.4.60.0100.07016.52
5.4.50.0070.06316.47
5.4.40.0070.07016.53
5.4.30.0100.07016.47
5.4.20.0070.07316.48
5.4.10.0070.04316.33
5.4.00.0170.03315.80
5.3.290.0100.07014.91
5.3.280.0070.04014.61
5.3.270.0000.04714.57
5.3.260.0030.08014.61
5.3.250.0100.06314.59
5.3.240.0130.03714.73
5.3.230.0100.06714.73
5.3.220.0100.06014.60
5.3.210.0000.08014.42
5.3.200.0000.07314.58
5.3.190.0100.07014.55
5.3.180.0030.04314.59
5.3.170.0170.06714.79
5.3.160.0070.06314.59
5.3.150.0100.07014.56
5.3.140.0000.08314.64
5.3.130.0030.09014.54
5.3.120.0030.07314.41
5.3.110.0030.07714.56
5.3.100.0000.08014.13
5.3.90.0100.03714.11
5.3.80.0100.06714.10
5.3.70.0100.04714.00
5.3.60.0070.07014.13
5.3.50.0030.05313.95
5.3.40.0100.03014.02
5.3.30.0030.04713.76
5.3.20.0100.06713.64
5.3.10.0070.06713.66
5.3.00.0030.04313.67
5.2.170.0100.04711.21
5.2.160.0030.03311.37
5.2.150.0070.05711.14
5.2.140.0100.05311.16
5.2.130.0000.04711.12
5.2.120.0000.05011.10
5.2.110.0030.06311.07
5.2.100.0030.02711.07
5.2.90.0030.03010.95
5.2.80.0030.05311.17
5.2.70.0100.05311.07
5.2.60.0100.05711.06
5.2.50.0100.05311.02
5.2.40.0070.05710.96
5.2.30.0100.05010.93
5.2.20.0030.06010.82
5.2.10.0000.06011.01
5.2.00.0070.05010.71
5.1.60.0030.05710.03
5.1.50.0130.03710.03
5.1.40.0030.05710.03
5.1.30.0030.05310.31
5.1.20.0130.04710.34
5.1.10.0070.05310.14
5.1.00.0030.05710.03
5.0.50.0030.05010.03
5.0.40.0070.04310.03
5.0.30.0030.06310.03
5.0.20.0100.04010.03
5.0.10.0000.04710.03
5.0.00.0030.06310.03
4.4.90.0000.03710.03
4.4.80.0030.03710.03
4.4.70.0070.03310.03
4.4.60.0000.03710.03
4.4.50.0030.03710.03
4.4.40.0000.05710.03
4.4.30.0070.03010.03
4.4.20.0070.03310.03
4.4.10.0100.02710.03
4.4.00.0030.04310.03
4.3.110.0000.03710.03
4.3.100.0030.03010.03
4.3.90.0070.02310.03
4.3.80.0030.05010.03
4.3.70.0130.01310.03
4.3.60.0030.01310.03
4.3.50.0000.01710.03
4.3.40.0000.04710.03
4.3.30.0000.02310.03
4.3.20.0000.02310.03
4.3.10.0030.02010.03
4.3.00.0000.02010.03

preferences:
65.63 ms | 401 KiB | 5 Q