3v4l.org

run code in 300+ PHP versions simultaneously
<?php $my_array = array( 0 => array( "name" => "john", "id" => 4 ), 1 => array( "name" => "mark", "id" => 152 ), 2 => array( "name" => "Eduard", "id" => 152 ) ); $needle = 152; $keys = []; foreach ($my_array as $key => ['id' => $id]) { if ($needle === $id) { $keys[] = $key; } } var_export($keys);

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.0100.01018.43
8.3.50.0110.00420.16
8.3.40.0110.00420.09
8.3.30.0060.00918.67
8.3.20.0050.00324.18
8.3.10.0080.00024.66
8.3.00.0080.00026.16
8.2.180.0120.00325.92
8.2.170.0070.01422.96
8.2.160.0070.00722.96
8.2.150.0070.00025.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0080.00021.00
8.2.110.0000.00922.25
8.2.100.0060.00617.91
8.2.90.0040.00417.84
8.2.80.0030.00519.23
8.2.70.0040.00417.63
8.2.60.0030.00517.63
8.2.50.0080.00017.59
8.2.40.0030.00619.35
8.2.30.0040.00419.58
8.2.20.0070.00019.31
8.2.10.0050.00218.11
8.2.00.0030.00519.31
8.1.280.0040.01125.92
8.1.270.0030.00621.98
8.1.260.0030.00626.35
8.1.250.0080.00028.09
8.1.240.0100.00022.66
8.1.230.0120.00020.97
8.1.220.0030.00517.74
8.1.210.0060.00318.77
8.1.200.0040.00417.36
8.1.190.0030.00617.23
8.1.180.0060.00318.10
8.1.170.0040.00417.76
8.1.160.0000.00718.92
8.1.150.0030.00518.55
8.1.140.0040.00417.36
8.1.130.0030.00319.06
8.1.120.0030.00317.46
8.1.110.0070.00017.41
8.1.100.0000.00817.34
8.1.90.0130.00317.45
8.1.80.0130.00317.33
8.1.70.0080.00717.26
8.1.60.0090.00917.46
8.1.50.0070.00017.51
8.1.40.0110.00717.52
8.1.30.0190.00017.65
8.1.20.0190.00017.61
8.1.10.0110.00717.58
8.1.00.0090.00917.52
8.0.300.0090.00020.14
8.0.290.0000.00816.63
8.0.280.0070.00018.01
8.0.270.0000.00818.02
8.0.260.0000.00618.45
8.0.250.0030.00316.92
8.0.240.0000.00717.02
8.0.230.0150.00016.89
8.0.220.0110.00316.84
8.0.210.0090.00416.81
8.0.200.0160.00016.80
8.0.190.0150.00016.90
8.0.180.0120.00316.88
8.0.170.0050.00916.77
8.0.160.0130.00216.87
8.0.150.0150.00016.82
8.0.140.0070.00716.86
8.0.130.0150.00016.81
8.0.120.0150.00016.70
8.0.110.0090.00516.86
8.0.100.0140.00016.77
8.0.90.0110.00316.69
8.0.80.0110.00416.90
8.0.70.0170.00016.84
8.0.60.0130.00216.91
8.0.50.0070.00716.84
8.0.30.0090.00616.74
8.0.20.0090.00616.88
8.0.10.0090.00416.91
7.4.330.0050.00015.55
7.4.320.0030.00316.47
7.4.300.0050.00516.59
7.4.290.0080.00816.55
7.4.280.0120.00616.59
7.4.270.0080.00816.55
7.4.260.0050.01116.40
7.4.250.0120.00416.62
7.4.240.0080.00816.61
7.4.230.0040.01216.58
7.4.220.0110.00416.59
7.4.210.0140.00016.55
7.4.200.0150.00016.60
7.4.190.0150.00016.65
7.4.180.0110.00316.54
7.4.160.0090.00616.66
7.4.150.0100.00316.50
7.4.140.0040.00416.37
7.4.130.0000.00716.34
7.4.120.0030.00316.40
7.4.110.0030.00316.35
7.4.100.0060.00016.64
7.4.90.0000.00716.43
7.4.80.0040.00416.33
7.4.70.0050.00616.50
7.4.60.0070.00716.34
7.4.50.0100.00016.36
7.4.40.0090.00216.39
7.4.30.0090.00316.40
7.4.20.0060.00316.30
7.4.10.0110.00016.42
7.4.00.0040.00416.54

preferences:
31.89 ms | 400 KiB | 5 Q