3v4l.org

run code in 300+ PHP versions simultaneously
<?php function converteData($format, $to_format, $date, $timezone = null) { if (!$timezone) { $timezone = new DateTimeZone(date_default_timezone_get()); } $d = date_create_from_format($format, $date, $timezone); return date_format($d, $to_format); } /* * Exemplos */ var_dump(converteData('2014-02-28 12:12:12')); # true var_dump(converteData('2014-02-30 12:12:12')); # false var_dump(converteData('2014-02-28', 'Y-m-d')); # true var_dump(converteData('28/02/2014', 'd/m/Y')); # true var_dump(converteData('30/02/2014', 'd/m/Y')); # false
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: Too few arguments to function converteData(), 1 passed in /in/2GF0m on line 16 and at least 3 expected in /in/2GF0m:2 Stack trace: #0 /in/2GF0m(16): converteData('2014-02-28 12:1...') #1 {main} thrown in /in/2GF0m on line 2
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:
59.58 ms | 401 KiB | 8 Q