3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function japan_holiday_ics() { // カレンダーID $calendar_id = urlencode('japanese__ja@holiday.calendar.google.com'); $url = 'https://calendar.google.com/calendar/ical/'.$calendar_id.'/public/full.ics'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($ch); curl_close($ch); if (!empty($result)) { $items = $sort = array(); $start = false; $count = 0; foreach(explode("\n", $result) as $row => $line) { // 1行目が「BEGIN:VCALENDAR」でなければ終了 if (0 === $row && false === stristr($line, 'BEGIN:VCALENDAR')) { break; } // 改行などを削除 $line = trim($line); // 「BEGIN:VEVENT」なら日付データの開始 if (false !== stristr($line, 'BEGIN:VEVENT')) { $start = true; } elseif ($start) { // 「END:VEVENT」なら日付データの終了 if (false !== stristr($line, 'END:VEVENT')) { $start = false; // 次のデータ用にカウントを追加 ++$count; } else { // 配列がなければ作成 if (empty($items[$count])) { $items[$count] = array('date' => null, 'title' => null); } // 「DTSTART;~」(対象日)の処理 if(0 === strpos($line, 'DTSTART;VALUE')) { $date = explode(':', $line); $date = end($date); $items[$count]['date'] = $date; // ソート用の配列にセット $sort[$count] = $date; } // 「SUMMARY:~」(名称)の処理 elseif(0 === strpos($line, 'SUMMARY:')) { list($title) = explode('/', substr($line, 8)); $items[$count]['title'] = trim($title); } } } } // 日付でソート $items = array_combine($sort, $items); ksort($items); return $items; } } japan_holiday_ics();
based on dYBTI
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/UCBho:7 Stack trace: #0 /in/UCBho(62): japan_holiday_ics() #1 {main} thrown in /in/UCBho on line 7
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Fatal error: Call to undefined function curl_init() in /in/UCBho on line 7
Process exited with code 255.