3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createDateFromFormat($format, $time) { $result = \DateTimeImmutable::createFromFormat($format, $time); var_dump($result); var_dump(); if (!$result || \DateTimeImmutable::getLastErrors()['warning_count']) { return false; } return $result; } var_dump(createDateFromFormat('Y-m-d', '2005-12-1')); var_dump(createDateFromFormat('Y-m-d', '2005')); var_dump(\DateTimeImmutable::createFromFormat('Y-m-d|', '2000-15-0')); $errors = \DateTime::getLastErrors(); var_dump(\DateTime::getLastErrors()); if (!empty($errors)) { return false; }
Output for git.master, git.master_jit, rfc.property-hooks
object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2005-12-01 15:28:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Fatal error: Uncaught ArgumentCountError: var_dump() expects at least 1 argument, 0 given in /in/GA7fA:9 Stack trace: #0 /in/GA7fA(9): var_dump() #1 /in/GA7fA(19): createDateFromFormat('Y-m-d', '2005-12-1') #2 {main} thrown in /in/GA7fA 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:
62.68 ms | 401 KiB | 8 Q