3v4l.org

run code in 300+ PHP versions simultaneously
<?php $movies = [ 'MOVIE TITLE #1' => [ 'id' => 11990, 'times' => [ '2023-06-03' => [ '11:00am', '2:30pm', '6:00pm', '9:30pm', ], '2023-06-04' => [ '12:30pm', '4:00pm', '7:30pm', ], '2023-06-06' => [ '12:30pm', '4:00pm', '7:30pm', ], ], ], 'MOVIE TITLE #2' => [ 'id' => 11892, 'times' => [ '2023-06-03' => [ '12:00pm', '3:30pm', '7:00pm', ], ], ], ]; $dates = array_flip(['2023-06-03', '2023-06-04']); $result = []; foreach ($movies as $title => ['times' => $times]) { foreach (array_intersect_key($times, $dates) as $date => $times) { $result[$date][$title] = $times; } } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( '2023-06-03' => array ( 'MOVIE TITLE #1' => array ( 0 => '11:00am', 1 => '2:30pm', 2 => '6:00pm', 3 => '9:30pm', ), 'MOVIE TITLE #2' => array ( 0 => '12:00pm', 1 => '3:30pm', 2 => '7:00pm', ), ), '2023-06-04' => array ( 'MOVIE TITLE #1' => array ( 0 => '12:30pm', 1 => '4:00pm', 2 => '7:30pm', ), ), )

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:
61.65 ms | 406 KiB | 5 Q