3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( 0 => array ( 'id' => 1, 'user_id' => 15, 'booked' => '2020-08-01', 'sendin' => '2020-08-03', 'pickup' => '2020-08-08', 'duration' => 5 ), 1 => array ( 'id' => 2, 'user_id' => 15, 'booked' => '2020-08-01', 'sendin' => '2020-08-03', 'pickup' => '2020-08-08', 'duration' => 5 ) ); $user_id = 15; $ids = array_map(function ($a) { return $a['id']; }, array_filter($array, function ($a) use ($user_id) { return $a['user_id'] == $user_id; }) ); print_r($ids); $ids = array_map(function ($k) use ($array) { return $array[$k]['id']; }, array_keys(array_column($array, 'user_id'), $user_id) ); print_r($ids);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => 1 [1] => 2 ) Array ( [0] => 1 [1] => 2 )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
15.92 ms | 405 KiB | 5 Q