3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[{ "title":"event 1", "timeFrom":"2019-11-16 19:00:00", "timeTo":"2019-11-18 22:00:00", "listText":"text of the event", "url":"https://url", "imageUrl":"https://image.jpg", "locations":{ "title":"Location name", "url":"https://location" } }, { "title":"event 2", "timeFrom":"2019-11-20 19:00:00", "timeTo":"2019-11-20 22:00:00", "listText":"text of the event", "url":"https://url", "imageUrl":"https://image.jpg", "locations":{ "title":"Location name", "url":"https://location" } }, { "title":"event 3", "timeFrom":"2019-11-17 19:00:00", "timeTo":"2019-11-17 22:00:00", "listText":"text of the event", "url":"https://url", "imageUrl":"https://image.jpg", "locations":{ "title":"Location name", "url":"https://location" }}]'; function find_events($events, $date) { $date = new DateTime($date); foreach ($events as $event) { $from = (new DateTime($event['timeFrom']))->setTime(0,0,0); $to = (new DateTime($event['timeTo']))->setTime(0,0,0); if ($date >= $from && $date <= $to) { echo "{$event['title']} ({$event['listText']}) from {$event['timeFrom']} to {$event['timeTo']}\n"; } } } $events = json_decode($json, true); find_events($events, '2019-11-17');
Output for git.master, git.master_jit, rfc.property-hooks
event 1 (text of the event) from 2019-11-16 19:00:00 to 2019-11-18 22:00:00 event 3 (text of the event) from 2019-11-17 19:00:00 to 2019-11-17 22:00:00

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:
58.65 ms | 401 KiB | 8 Q