3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP function mysql_date($in) { //Function takes a string in as form data, splits it by a list of //possible separators. If the resulting array has a length of 3, the //function returns a MySQL compatible date() string, else returns false // //Also, uses the checkdate() [PHP core function] to validate the date. $output = false; $d = preg_split('#[-/:. ]#', trim($in)); if (is_array($d) && count($d) == 3) { if (strlen($d[2]) == 2) { $d[2] = '20'.$d[2]; } if (checkdate($d[0], $d[1], $d[2])) { $output = "$d[2]-$d[0]-$d[1]"; } } return $output; } echo mysql_date('05/07/2014');
Output for git.master, git.master_jit, rfc.property-hooks
2014-05-07

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:
31.02 ms | 401 KiB | 8 Q