3v4l.org

run code in 300+ PHP versions simultaneously
<?php $output = array(); $txt='2014-14-26T00:00:00'; $re1='((?:(?:[1]{1}\\d{1}\\d{1}\\d{1})|(?:[2]{1}\\d{3}))[-:\\/.](?:[0]?[1-9]|[1][012])[-:\\/.](?:(?:[0-2]?\\d{1})|(?:[3][01]{1})))(?![\\d])'; $re2='(T)'; $re3='((?:(?:[0-1][0-9])|(?:[2][0-3])|(?:[0-9])):(?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)'; $regex = '(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})'; //if(!preg_match_all ("/".$re1.$re2.$re3."/is", $txt, $matches)){ if(preg_match($regex, $txt)){ $output["status"] = "error"; $output["reason"] = "not valid date"; print_r($output); } else{ $output["status"] = "ok"; $output["reason"] = "valid date"; print_r($output); }
Output for 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: preg_match(): Unknown modifier '-' in /in/79InF on line 16 Array ( [status] => ok [reason] => valid date )
Output for 4.3.0 - 4.3.10
Warning: Unknown modifier '-' in /in/79InF on line 16 Array ( [status] => ok [reason] => valid date )

preferences:
267.26 ms | 401 KiB | 353 Q