3v4l.org

run code in 300+ PHP versions simultaneously
<?php $filename = "2053839077_On_10_15_2014_By_d.willard@10_58_30 PM"; $r2 = "/(?P<phone>\d{10})_On_(?P<m>\d{1,2})_(?P<d>\d{1,2})_(?P<Y>\d{4})_By_.*@(?P<h>\d{1,2})_(?P<i>\d{1,2})_(?P<s>\d{1,2}) (?P<ampm>[AM|PM]{2})/"; if (preg_match($r2, $filename, $bits)) { $phone = $bits['phone']; $hour = $bits['h']; if ($bits['ampm'] == 'PM') { $hour += 12; } $year = $bits['Y']; $month = sprintf('%02s', $bits['m']); $day = sprintf('%02s', $bits['d']); $hour = sprintf('%02s', $hour); $min = sprintf('%02s', $bits['i']); $sec = sprintf('%02s', $bits['s']); $timestamp = "$year-$month-$day $hour:$min:$sec"; } echo $phone.PHP_EOL; echo $timestamp.PHP_EOL; echo $bits['ampm']; ?>
Output for 4.3.10 - 4.3.11, 4.4.0 - 4.4.9, 5.0.2 - 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.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 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.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
2053839077 2014-10-15 22:58:30 PM
Output for 4.3.3 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/iEJZP on line 22 2053839077PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/iEJZP on line 23 2014-10-15 22:58:30PHP_EOLPM
Output for 4.3.0 - 4.3.2
Notice: Undefined index: phone in /in/iEJZP on line 8 Notice: Undefined index: h in /in/iEJZP on line 9 Notice: Undefined index: ampm in /in/iEJZP on line 10 Notice: Undefined index: Y in /in/iEJZP on line 13 Notice: Undefined index: m in /in/iEJZP on line 14 Notice: Undefined index: d in /in/iEJZP on line 15 Notice: Undefined index: i in /in/iEJZP on line 17 Notice: Undefined index: s in /in/iEJZP on line 18 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/iEJZP on line 22 PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/iEJZP on line 23 -00-00 00:00:00PHP_EOL Notice: Undefined index: ampm in /in/iEJZP on line 24

preferences:
308.48 ms | 403 KiB | 459 Q