3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('UTC'); $currentDateTime = new DateTime(); $url = 'https://www.lmsal.com/hek/hcr?cmd=view-planned-events&instrument=iris'; $content = file_get_contents($url); $dom = new DOMDocument(); @$dom->loadHTML($content); $table = $dom->getElementsByTagName('table')->item(0); $rows = $table->getElementsByTagName('tr'); foreach($rows as $row) { $columns = $row->getElementsByTagName('td'); if ($columns->length > 0) { $dateTimeRange = $columns->item(0)->nodeValue; // Match the pattern "YYYY-MM-DD HH:MM:SS - HH:MM:SS" and store the matches in $matches array preg_match_all('/\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}-\d{2}:\d{2}:\d{2}/', $dateTimeRange, $matches); foreach ($matches[0] as $match) { list($start, $end) = explode("-", $match); $startDateTime = DateTime::createFromFormat('Y-m-d H:i:s', trim($start)); $endDateTime = DateTime::createFromFormat('Y-m-d H:i:s', trim($end)); // If the current time is within the start and end times, print it out if ($startDateTime <= $currentDateTime && $currentDateTime <= $endDateTime) { echo $match . '<br>'; } } } } ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /in/kXYqA on line 6 Warning: file_get_contents(): open_basedir restriction in effect. File(https://www.lmsal.com/hek/hcr?cmd=view-planned-events&instrument=iris) is not within the allowed path(s): (/tmp:/in:/etc) in /in/kXYqA on line 6 Warning: file_get_contents(https://www.lmsal.com/hek/hcr?cmd=view-planned-events&instrument=iris): Failed to open stream: Operation not permitted in /in/kXYqA on line 6 Fatal error: Uncaught ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty in /in/kXYqA:9 Stack trace: #0 /in/kXYqA(9): DOMDocument->loadHTML('') #1 {main} thrown in /in/kXYqA on line 9
Process exited with code 255.

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