Php Find Last Char In String Python Replace Nan