3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(decode_permissions(3)); //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.0070.01416.50
8.3.50.0110.00921.11
8.3.40.0070.01118.71
8.3.30.0040.01119.08
8.3.20.0040.00420.14
8.3.10.0000.00821.76
8.3.00.0040.00417.63
8.2.180.0140.00718.29
8.2.170.0060.00918.97
8.2.160.0100.00722.96
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00021.13
8.2.110.0060.00320.98
8.2.100.0090.00317.78
8.2.90.0000.00817.75
8.2.80.0000.00817.97
8.2.70.0040.00417.47
8.2.60.0040.00417.80
8.2.50.0090.00018.07
8.2.40.0040.00419.95
8.2.30.0050.00218.06
8.2.20.0030.00517.68
8.2.10.0000.00818.07
8.2.00.0000.00718.16
8.1.280.0110.00425.92
8.1.270.0080.00820.20
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00622.52
8.1.230.0040.00820.98
8.1.220.0060.00317.74
8.1.210.0030.00518.77
8.1.200.0090.00317.11
8.1.190.0000.00817.23
8.1.180.0070.00018.10
8.1.170.0040.00420.28
8.1.160.0000.00821.95
8.1.150.0040.00418.84
8.1.140.0000.00817.44
8.1.130.0030.00317.87
8.1.120.0000.00717.28
8.1.110.0040.00417.37
8.1.100.0040.00417.47
8.1.90.0040.00417.30
8.1.80.0050.00317.34
8.1.70.0080.00017.38
8.1.60.0000.00817.43
8.1.50.0040.00417.43
8.1.40.0030.00617.54
8.1.30.0000.00817.64
8.1.20.0000.00717.56
8.1.10.0080.00017.44
8.1.00.0040.00417.38
8.0.300.0050.00219.90
8.0.290.0000.00716.63
8.0.280.0080.00018.30
8.0.270.0070.00017.12
8.0.260.0000.00617.12
8.0.250.0030.00316.88
8.0.240.0030.00316.92
8.0.230.0040.00416.80
8.0.220.0080.00016.84
8.0.210.0040.00416.88
8.0.200.0030.00316.89
8.0.190.0000.00816.88
8.0.180.0060.00516.82
8.0.170.0000.00716.90
8.0.160.0000.00716.88
8.0.150.0000.00716.71
8.0.140.0050.00316.80
8.0.130.0040.00413.25
8.0.120.0060.00316.82
8.0.110.0030.00516.70
8.0.100.0070.00016.89
8.0.90.0050.00316.66
8.0.80.0160.00016.74
8.0.70.0050.00216.84
8.0.60.0000.00816.73
8.0.50.0040.00416.86
8.0.30.0140.00917.01
8.0.20.0080.01117.40
8.0.10.0000.00717.05
8.0.00.0080.01016.67
7.4.330.0000.00615.04
7.4.320.0030.00316.59
7.4.300.0040.00416.58
7.4.290.0070.00316.41
7.4.280.0000.00916.41
7.4.270.0000.00716.66
7.4.260.0030.00316.60
7.4.250.0000.00716.57
7.4.240.0020.00616.54
7.4.230.0030.00316.56
7.4.220.0090.01316.66
7.4.210.0090.00616.64
7.4.200.0080.00016.50
7.4.160.0040.01116.41
7.4.150.0090.00917.40
7.4.140.0140.01017.86
7.4.130.0090.01016.51
7.4.120.0090.01116.46
7.4.110.0160.00616.64
7.4.100.0060.01916.38
7.4.90.0070.01016.45
7.4.80.0120.01019.39
7.4.70.0110.00616.36
7.4.60.0130.00616.21
7.4.50.0080.00016.26
7.4.40.0070.01016.39
7.4.30.0090.00916.31
7.4.00.0070.01014.86
7.3.330.0000.00513.34
7.3.320.0070.00713.13
7.3.310.0000.00816.35
7.3.300.0000.00716.28
7.3.290.0020.01316.23
7.3.280.0090.00616.30
7.3.270.0070.01017.40
7.3.260.0050.01116.44
7.3.250.0120.00816.17
7.3.240.0100.00716.55
7.3.230.0070.01716.56
7.3.210.0150.00916.52
7.3.200.0030.01319.39
7.3.190.0000.01616.28
7.3.180.0100.00616.18
7.3.170.0060.01516.36
7.3.160.0060.01016.52
7.3.120.0140.00314.75
7.3.110.0100.00714.95
7.3.100.0070.01014.86
7.3.90.0030.01214.64
7.3.80.0130.00314.72
7.3.70.0060.00314.47
7.3.60.0070.00714.86
7.3.50.0060.01014.78
7.3.40.0030.00914.82
7.3.30.0030.01014.74
7.3.20.0090.00616.38
7.3.10.0070.00516.73
7.3.00.0050.00716.65
7.2.330.0120.00616.67
7.2.320.0060.01216.48
7.2.310.0140.00516.68
7.2.300.0060.01016.29
7.2.290.0030.01916.51
7.2.250.0080.00914.88
7.2.240.0060.01014.91
7.2.230.0090.00614.89
7.2.220.0050.00515.11
7.2.210.0040.00814.95
7.2.200.0090.00314.89
7.2.190.0070.00714.66
7.2.180.0100.00714.98
7.2.170.0060.01014.97
7.2.130.0000.01316.85
7.2.120.0070.01016.62
7.2.110.0070.01016.78
7.2.100.0120.00316.74
7.2.90.0030.01416.86
7.2.80.0060.00916.65
7.2.70.0060.01016.73
7.2.60.0120.00316.78
7.2.50.0000.01216.85
7.2.40.0060.00916.92
7.2.30.0000.01416.99
7.2.20.0000.01016.81
7.2.10.0070.00716.78
7.2.00.0070.00618.05
7.1.330.0030.01015.82
7.1.320.0030.00615.66
7.1.310.0040.01215.90
7.1.300.0150.00015.66
7.1.290.0110.00415.46
7.1.280.0000.01215.68
7.1.270.0060.01015.72
7.1.260.0040.01215.87
7.1.250.0000.01415.76
7.1.100.0060.00917.88
7.1.70.0090.00417.15
7.1.60.0110.00817.17
7.1.50.0130.00316.86
7.1.40.0030.00716.77
7.1.30.0040.01216.65
7.1.20.0070.00716.73
7.1.10.0080.00816.70
7.1.00.0030.00516.46
7.0.200.0080.00416.55
7.0.190.0040.00916.62
7.0.180.0030.01016.21
7.0.170.0070.00716.17
7.0.160.0040.00816.37
7.0.150.0070.01016.21
7.0.140.0000.01616.44
7.0.130.0060.00616.49
7.0.120.0080.00516.48
7.0.110.0030.00916.39
7.0.100.0070.01016.30
7.0.90.0000.01216.43
7.0.80.0040.01116.32
7.0.70.0000.01316.35
7.0.60.0060.00916.16
7.0.50.0080.00416.60
7.0.40.0000.01315.38
7.0.30.0060.00615.38
7.0.20.0040.00815.38
7.0.10.0070.00515.38
7.0.00.0000.00915.38
5.6.300.0190.08520.96
5.6.290.0070.04420.68
5.6.280.0000.05320.86
5.6.270.0120.03921.07
5.6.260.0130.03820.93
5.6.250.0060.04720.82
5.6.240.0030.05520.98
5.6.230.0100.03920.96
5.6.220.0070.04120.93
5.6.210.0030.04721.09
5.6.200.0100.07920.82
5.6.190.0160.04720.93
5.6.180.0070.04421.06
5.6.170.0000.05520.94
5.6.160.0070.04420.85
5.6.150.0100.04120.93
5.6.140.0100.04421.00
5.6.130.0060.05020.81
5.6.120.0030.05820.84
5.6.110.0160.03320.83
5.6.100.0070.04121.02
5.6.90.0030.06520.80
5.6.80.0030.07020.37
5.6.70.0030.04320.41
5.6.60.0060.05220.21
5.6.50.0070.06420.42
5.6.40.0060.04120.20
5.6.30.0200.03720.15
5.6.20.0070.04520.40
5.6.10.0070.03920.19
5.6.00.0070.04620.33
5.5.380.0060.04517.53
5.5.370.0070.06317.46
5.5.360.0000.05217.43
5.5.350.0120.04017.56
5.5.340.0000.04617.74
5.5.330.0030.04518.09
5.5.320.0030.04318.15
5.5.310.0030.04218.00
5.5.300.0070.04117.86
5.5.290.0030.06217.84
5.5.280.0070.04018.13
5.5.270.0030.04917.85
5.5.260.0090.04317.85
5.5.250.0070.03617.67
5.5.240.0000.04317.38
5.5.230.0000.04317.48
5.5.220.0040.03917.46
5.5.210.0100.04117.48
5.5.200.0030.04017.38
5.5.190.0070.04017.44
5.5.180.0100.04217.33
5.5.160.0030.04217.41
5.5.150.0100.03917.41
5.5.140.0000.04617.09
5.5.130.0030.04117.44
5.5.120.0030.04517.40
5.5.110.0100.03617.35
5.5.100.0000.04317.29
5.5.90.0040.04617.36
5.5.80.0070.04117.35
5.5.70.0030.04217.28
5.5.60.0030.04517.33
5.5.50.0070.03717.25
5.5.40.0100.03317.35
5.5.30.0070.03517.27
5.5.20.0030.04417.30
5.5.10.0090.03717.37
5.5.00.0070.04417.20
5.4.450.0030.04919.41
5.4.440.0040.04419.39
5.4.430.0000.04619.55
5.4.420.0070.03819.42
5.4.410.0070.03619.34
5.4.400.0030.05618.96
5.4.390.0030.06419.07
5.4.380.0030.03918.98
5.4.370.0070.03619.19
5.4.360.0040.03919.14
5.4.350.0030.04219.07
5.4.340.0070.04318.98
5.4.320.0030.04119.21
5.4.310.0130.03519.23
5.4.300.0070.03918.91
5.4.290.0100.03419.23
5.4.280.0030.04518.98
5.4.270.0040.03919.11
5.4.260.0100.03319.05
5.4.250.0070.03718.91
5.4.240.0100.03319.22
5.4.230.0030.04319.20
5.4.220.0000.04419.06
5.4.210.0130.03519.11
5.4.200.0030.03819.07
5.4.190.0070.04019.09
5.4.180.0100.03319.06
5.4.170.0030.04919.05
5.4.160.0180.03019.20
5.4.150.0100.03618.96
5.4.140.0060.04516.63
5.4.130.0100.04216.73
5.4.120.0140.03516.81
5.4.110.0130.03916.46
5.4.100.0000.04716.78
5.4.90.0100.03616.46
5.4.80.0140.03416.74
5.4.70.0140.03516.75
5.4.60.0000.03716.41
5.4.50.0030.03516.41
5.4.40.0040.05416.46
5.4.30.0060.03516.61
5.4.20.0000.04116.41
5.4.10.0000.03916.59
5.4.00.0100.03615.98
5.3.290.0030.04415.38
5.3.280.0030.04315.38
5.3.270.0030.04015.38
5.3.260.0030.04215.38
5.3.250.0030.04315.38
5.3.240.0030.04515.38
5.3.230.0070.04415.38
5.3.220.0000.04815.38
5.3.210.0070.03815.38
5.3.200.0070.03815.38
5.3.190.0100.03715.38
5.3.180.0060.03815.38
5.3.170.0040.03915.38
5.3.160.0070.03315.38
5.3.150.0030.03615.38
5.3.140.0000.04015.38
5.3.130.0070.03715.38
5.3.120.0030.03815.38
5.3.110.0060.03515.38
5.3.100.0030.03515.38
5.3.90.0030.04315.38
5.3.80.0040.03615.38
5.3.70.0030.03615.38
5.3.60.0030.03715.38
5.3.50.0040.03315.38
5.3.40.0000.03715.38
5.3.30.0000.03915.38
5.3.20.0000.03615.38
5.3.10.0070.03115.38
5.3.00.0000.03815.38
5.2.170.0070.03615.38
5.2.160.0030.03215.38
5.2.150.0070.03915.38
5.2.140.0060.02615.38
5.2.130.0040.02915.38
5.2.120.0030.03115.38
5.2.110.0030.03215.38
5.2.100.0000.03415.38
5.2.90.0030.03015.38
5.2.80.0030.02915.38
5.2.70.0030.02915.38
5.2.60.0000.03415.38
5.2.50.0030.03415.38
5.2.40.0030.03215.38
5.2.30.0030.03215.38
5.2.20.0000.03315.38
5.2.10.0060.03015.38
5.2.00.0030.03415.38
5.1.60.0030.03115.38
5.1.50.0000.03415.38
5.1.40.0030.02815.38
5.1.30.0030.03115.38
5.1.20.0300.02015.38
5.1.10.0040.02615.38
5.1.00.0000.02815.38
5.0.50.0030.02015.38
5.0.40.0000.02315.38
5.0.30.0030.03015.38
5.0.20.0000.02215.38
5.0.10.0030.02015.38
5.0.00.0000.03215.38
4.4.90.0000.02015.38
4.4.80.0070.01015.38
4.4.70.0000.01715.38
4.4.60.0030.01315.38
4.4.50.0070.02015.38
4.4.40.0140.01815.38
4.4.30.0040.01515.38
4.4.20.0000.01715.38
4.4.10.0030.01415.38
4.4.00.0070.02015.38
4.3.110.0030.01815.38
4.3.100.0100.01715.38
4.3.90.0000.01615.38
4.3.80.0000.02615.38
4.3.70.0000.02315.38
4.3.60.0030.02015.38
4.3.50.0000.02115.38
4.3.40.0060.01915.38
4.3.30.0000.01815.38
4.3.20.0000.01715.38
4.3.10.0030.01315.38
4.3.00.0000.01915.38

preferences:
70.34 ms | 401 KiB | 5 Q