3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = [ 123 => ['name' => 'xxx'], 456 => ['name' => 'yyy'], ]; echo \array_key_exists(123, $x) ? 'yes' : 'no'; echo "\n"; $x = [ ['id' => 123, 'name' => 'xxx'], ['id' => 456, 'name' => 'yyy'], ]; $check = 123; $y = \array_filter($x, function ($value) use ($check) { return $value['id'] === $check; }); echo \count($y) ? 'yes' : 'no'; // if array child id === 123 in any of the children, // then echo yes, // (without using a loop, and by using an array function)

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.70.0040.01118.31
8.3.60.0410.00925.92
8.3.50.0130.00725.92
8.3.40.0350.00825.92
8.3.30.0370.00725.92
8.3.20.0290.01325.92
8.3.10.0250.01225.92
8.3.00.0420.00925.92
8.2.190.0070.01116.58
8.2.180.0450.00325.92
8.2.170.0390.01225.92
8.2.160.0440.00625.92
8.2.150.0380.00325.92
8.2.140.0450.00425.92
8.2.130.0400.00325.92
8.2.120.0360.01325.92
8.2.110.0370.00425.92
8.2.100.0440.01125.92
8.2.90.0340.01525.92
8.2.80.0400.01225.92
8.2.70.0440.00425.92
8.2.60.0320.01125.92
8.2.50.0210.01425.92
8.2.40.0310.00325.92
8.2.30.0270.00325.92
8.2.20.0270.00325.92
8.2.10.0190.01125.92
8.2.00.0320.00625.92
8.1.280.0370.00425.92
8.1.270.0450.00925.92
8.1.260.0370.00725.92
8.1.250.0300.01025.92
8.1.240.0330.01025.92
8.1.230.0300.01225.92
8.1.220.0330.01025.92
8.1.210.0360.01125.92
8.1.200.0310.00825.92
8.1.190.0230.01325.92
8.1.180.0350.00325.92
8.1.170.0310.01425.92
8.1.160.0380.00025.92
8.1.150.0300.00425.92
8.1.140.0290.00425.92
8.1.130.0380.00725.92
8.1.120.0490.00725.92
8.1.110.0350.01125.92
8.1.100.0370.01025.92
8.1.90.0360.00625.92
8.1.80.0420.00425.92
8.1.70.0340.01225.92
8.1.60.0320.01425.92
8.1.50.0400.00625.92
8.1.40.0420.01225.92
8.1.30.0480.00625.92
8.1.20.0390.01125.92
8.1.10.0310.01325.92
8.1.00.0450.00625.92

preferences:
16.84 ms | 401 KiB | 5 Q