3v4l.org

run code in 300+ PHP versions simultaneously
<?php // birthdays in 20th century: $formatted = ""; $arrFormattedBDays = []; $birthdays = ['18-Jul-01','19-Aug-47','1-Jan-19','31-Dec-18','23-Dec-00']; foreach ($birthdays as $b){ list($d,$m,$y) = explode("-",$b); switch($y) { case "00": $y = '20'.$y; break; default: $y = '19' . $y; break; } $dt = new DateTime("$d-$m-$y"); var_dump($dt); $formatted = $dt->format('d/m/Y'); $arrFormattedBDays[] = $formatted; } var_dump($arrFormattedBDays);
Output for git.master, git.master_jit, rfc.property-hooks
object(DateTime)#1 (3) { ["date"]=> string(26) "1901-07-18 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "1947-08-19 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "1919-01-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "1918-12-31 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2000-12-23 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } array(5) { [0]=> string(10) "18/07/1901" [1]=> string(10) "19/08/1947" [2]=> string(10) "01/01/1919" [3]=> string(10) "31/12/1918" [4]=> string(10) "23/12/2000" }

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:
107.51 ms | 408 KiB | 5 Q