- {$inner}"; } $euro = intdiv($amount, 100); $cent = sprintf("%02d", $amount % 100); return "{$euro},{$cent} €"; } public static function parseAmount(string $amount): ?int { $pattern = '/^([0-9]+)(,([0-9]{2}))?$/'; if (preg_match($pattern, $amount, $matches)) { $euro = (int) $matches[1]; $cent = (int) ($matches[3] ?? 0); $amount = 100 * $euro + $cent; return (int) $amount; } return null; } }