3v4l.org

run code in 300+ PHP versions simultaneously
<?php function date_generator($ex_weeks = array(), $ex_DateTimeObjects = array()) { $kanji_w = array('日', '月', '火', '水', '木', '金', '土'); $now = new DateTime('now', new DateTimezon('Asia/Tokyo')); for ($i = 2; $i < 30; $i++) { $current = $now->add(new DateInterval("P{$i}D")); if (in_array($current->format('w'), $ex_weeks)) { continue; } foreach ($ex_DateTimeObjects as $object) { if (!$object->diff($current)->days) { continue 2; } } $w = $kanji_w[$current->format('w')]; yield $current->format('n月j日') . $w; } } ?> <select name="date"> <?php foreach (date_generator(array(1), array(new DateTime('12/25'))) as $value): ?> <option value="<?=$value?>"><?=$value?></option> <?php endforeach; ?> </select>
Output for git.master, git.master_jit, rfc.property-hooks
<select name="date"> Fatal error: Uncaught Error: Class "DateTimezon" not found in /in/LDinS:5 Stack trace: #0 /in/LDinS(23): date_generator(Array, Array) #1 {main} thrown in /in/LDinS on line 5
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.46 ms | 401 KiB | 8 Q