And that is exactly why this code is broken.
$temp .= date(substr($formatum, $i, $a-$i), $timestamp) .
$q[$formatum[$a]][date($q[$formatum[$a]][-1], $timestamp)];
Specifically (there may be other places, this is one I found), where he uses
$formatum[$a]
He is expecting this...