3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str_date = '12.31.2018'; try{ if($valid = (new \DateTime($str_date))){ echo $valid->getTimeStamp(); } } catch(Exception $e){ try { $str_date = (str_replace('.','/',$str_date)); if($valid = (new \DateTime($str_date))){ echo $valid->getTimeStamp(); } } catch(Exception $e){ echo $e->getMessage(); } } ?>
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.2.7
1546210800