3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ "Dec 23 21:37:56 hello", "Jan 12 02:07:23 hello", "Jun 3 23:34:34 hello", "Dec 25 12:47:51 hello" ]; var_export( preg_replace_callback( '/^([a-z]{3}) +\d+/i', function($m) { static $encounteredJan = false; $encounteredJan = $encounteredJan || $m[1] === 'Jan'; return date('Y m d', strtotime($m[0] . ($encounteredJan ? '' : ' -1 year'))); }, $arr ) );

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
158.25 ms | 1747 KiB | 12 Q