3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ 'record_id' => 3, 'task_date' => '2018-10-02' ], [ 'record_id' => 5, 'task_date' => '2018-10-02' ], [ 'record_id' => 1, 'task_date' => '2018-09-27' ] ]; $out = []; $datesIterated = []; foreach ($data as $date) { if(in_array($date['task_date'], $datesIterated)) { continue; } $out[] = array_filter($data, function($item) use ($date) { if ($item['task_date'] == $date['task_date']) { return $item; } }); $datesIterated[] = $date['task_date']; } var_dump($out);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(2) { [0]=> array(2) { ["record_id"]=> int(3) ["task_date"]=> string(10) "2018-10-02" } [1]=> array(2) { ["record_id"]=> int(5) ["task_date"]=> string(10) "2018-10-02" } } [1]=> array(1) { [2]=> array(2) { ["record_id"]=> int(1) ["task_date"]=> string(10) "2018-09-27" } } }

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:
34.83 ms | 402 KiB | 8 Q