Optimized preg_replace in replace vars