3v4l.org

run code in 300+ PHP versions simultaneously
<?php $officialGrid = [ ['grid' => TRUE, 'time' => '08:00', 'content' => NULL], ['grid' => TRUE, 'time' => '09:00', 'content' => NULL] ]; $bookings = [ ['grid' => NULL, 'time' => '08:00', 'content' => 'Paul Simon'], ['grid' => NULL, 'time' => '08:00', 'content' => 'Art Garfunkel'], ['grid' => NULL, 'time' => '08:39', 'content' => 'Homer J. Simpson'] ]; $timeSlotsToDisplay = $officialGrid; array_map(function($el) use(&$timeSlotsToDisplay, $officialGrid) { $timeSlotsToDisplay[$el['time']] = array( 'content' => (isset($timeSlotsToDisplay[$el['time']]) ? trim($timeSlotsToDisplay[$el['time']]['content'], ',') . ',' : '') . $el['content'], 'grid' => isset($officialGrid[$el['time']]) ? true : null ); }, $bookings); ksort($timeSlotsToDisplay); var_export($timeSlotsToDisplay);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'grid' => true, 'time' => '08:00', 'content' => NULL, ), '08:00' => array ( 'content' => 'Paul Simon,Art Garfunkel', 'grid' => NULL, ), '08:39' => array ( 'content' => 'Homer J. Simpson', 'grid' => NULL, ), 1 => array ( 'grid' => true, 'time' => '09:00', 'content' => NULL, ), )

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:
40.24 ms | 1022 KiB | 4 Q