3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isArrayFieldSet(array $array, $field, $separator = '/') { if (strpos($field, $separator) !== false) { $path = explode($separator, $field); $field = array_shift($path); if (!is_null($field) && isset($array[$field])) { if (count($path) > 0) { return isArrayFieldSet($array[$field], implode($separator, $path), $separator); } return true; } else { return false; } } return isset($array[$field]); } $array = [ 'a' => 'test', 'b' => [ 'b2' => 123, 'b3' => [ 'test' => true ] ] ]; $shouldPass = [ 'a', 'b', 'b/b2', 'b/b3', 'b/b3/test' ]; $shouldNotPass = [ 'c', 'b/b1', 'b/b2/bx', 'b/b3/test/x', 'c/L1', 'a/k15', ]; foreach ($shouldPass as $test) { isArrayFieldSet($array, $test, '/'); } foreach ($shouldNotPass as $test) { isArrayFieldSet($array, $test, '/'); }

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.0090.00616.75
8.3.50.0150.00618.27
8.3.40.0090.00618.92
8.3.30.0110.00418.88
8.3.20.0040.00419.98
8.3.10.0040.00423.52
8.3.00.0050.00319.38
8.2.180.0110.00718.41
8.2.170.0110.00422.96
8.2.160.0070.00720.35
8.2.150.0000.00924.18
8.2.140.0050.00224.66
8.2.130.0080.00017.75
8.2.120.0050.00326.35
8.2.110.0110.00021.00
8.2.100.0090.00318.04
8.2.90.0080.00018.16
8.2.80.0060.00617.97
8.2.70.0060.00317.63
8.2.60.0050.00317.93
8.2.50.0040.00418.07
8.2.40.0050.00219.38
8.2.30.0070.00020.59
8.2.20.0040.00817.80
8.2.10.0040.00418.17
8.2.00.0000.00718.16
8.1.280.0060.00925.92
8.1.270.0090.00023.73
8.1.260.0040.00428.09
8.1.250.0140.00028.09
8.1.240.0030.00522.20
8.1.230.0080.00421.04
8.1.220.0040.00417.76
8.1.210.0030.00518.79
8.1.200.0060.00317.36
8.1.190.0000.00817.35
8.1.180.0000.00918.10
8.1.170.0040.00418.62
8.1.160.0040.00422.05
8.1.150.0040.00418.88
8.1.140.0030.00619.63
8.1.130.0030.00317.74
8.1.120.0000.00717.50
8.1.110.0050.00317.48
8.1.100.0050.00217.40
8.1.90.0000.00817.35
8.1.80.0070.00017.53
8.1.70.0030.00317.48
8.1.60.0080.00017.48
8.1.50.0000.00817.56
8.1.40.0040.00417.56
8.1.30.0030.00517.66
8.1.20.0000.00817.51
8.1.10.0000.00717.52
8.1.00.0030.00617.47
8.0.300.0050.00320.26
8.0.290.0040.00416.88
8.0.280.0000.00718.47
8.0.270.0000.00717.30
8.0.260.0060.00017.21
8.0.250.0000.00816.93
8.0.240.0040.00417.09
8.0.230.0050.00217.12
8.0.220.0040.00316.95
8.0.210.0000.00716.83
8.0.200.0070.00016.92
8.0.190.0000.00817.07
8.0.180.0040.00417.03
8.0.170.0050.00316.91
8.0.160.0040.00417.03
8.0.150.0030.00516.87
8.0.140.0000.00816.98
8.0.130.0000.00713.47
8.0.120.0040.00416.88
8.0.110.0030.00516.98
8.0.100.0070.00016.88
8.0.90.0040.00417.05
8.0.80.0070.01017.02
8.0.70.0040.00416.83
8.0.60.0030.00516.82
8.0.50.0070.00016.82
8.0.30.0110.00817.02
8.0.20.0100.00917.40
8.0.10.0030.00617.16
8.0.00.0060.01117.02
7.4.330.0030.00316.79
7.4.320.0000.00716.57
7.4.300.0000.00616.63
7.4.290.0000.00716.66
7.4.280.0000.00816.68
7.4.270.0030.00316.48
7.4.260.0050.00216.47
7.4.250.0040.00416.56
7.4.240.0010.00616.52
7.4.230.0030.00316.43
7.4.220.0040.01616.66
7.4.210.0000.01416.55
7.4.200.0030.00316.66
7.4.160.0060.00916.55
7.4.150.0110.00717.40
7.4.140.0120.00917.86
7.4.130.0080.01416.61
7.4.120.0100.01016.52
7.4.110.0090.00916.69
7.4.100.0060.01216.68
7.4.90.0100.00716.67
7.4.80.0070.01019.39
7.4.70.0030.01316.74
7.4.60.0090.01016.60
7.4.50.0040.01216.51
7.4.40.0070.01716.49
7.4.30.0070.01016.70
7.4.00.0030.01014.98
7.3.330.0040.00713.29
7.3.320.0030.00313.48
7.3.310.0050.00316.45
7.3.300.0030.00316.32
7.3.290.0090.00516.45
7.3.280.0120.00816.45
7.3.270.0090.00917.40
7.3.260.0130.00716.51
7.3.250.0070.01116.57
7.3.240.0040.01416.57
7.3.230.0100.00716.44
7.3.210.0070.01016.67
7.3.200.0070.01016.57
7.3.190.0080.00816.72
7.3.180.0170.00016.46
7.3.170.0110.00716.52
7.3.160.0140.00716.54
7.2.330.0070.01016.70
7.2.320.0090.01416.70
7.2.310.0110.00516.60
7.2.300.0060.01116.59
7.2.290.0070.01016.77
7.2.60.0000.01316.57
7.2.00.0070.00719.61
7.1.200.0090.00315.66
7.1.100.0000.01117.94
7.1.70.0040.00417.11
7.1.60.0100.01419.36
7.1.50.0040.00817.00
7.1.00.0000.08022.30
7.0.200.0030.00616.82
7.0.60.0130.06319.88
7.0.50.0030.07017.90
7.0.40.0000.04720.18
7.0.30.0470.06720.34
7.0.20.0230.03720.19
7.0.10.0000.06720.24
7.0.00.0130.06020.22
5.6.280.0030.06321.11
5.6.210.0130.08020.55
5.6.200.0030.08318.21
5.6.190.0100.04320.47
5.6.180.0300.06020.48
5.6.170.0200.06020.47
5.6.160.0100.04320.55
5.6.150.0030.08718.18
5.6.140.0100.03318.18
5.6.130.0030.08718.15
5.6.120.0030.08020.90
5.6.110.0170.05720.97
5.6.100.0130.06021.00
5.6.90.0100.06721.09
5.6.80.0070.07320.38
5.5.350.0230.06020.45
5.5.340.0070.04017.99
5.5.330.0070.07020.31
5.5.320.0070.07720.36
5.5.310.0400.04320.34
5.5.300.0100.07717.98
5.5.290.0030.04318.07
5.5.280.0130.07320.97
5.5.270.0100.08020.73
5.5.260.0030.04320.89
5.5.250.0130.07720.50
5.5.240.0200.07020.16

preferences:
50.64 ms | 400 KiB | 5 Q