5 ms·
It's a scream how easy it is in PHP of all things: function is_palindrome(string $str): bool { return $str === implode('', array_reverse(grapheme_s
by chuckadams 1y ago
It's a scream how easy it is in PHP of all things:
function is_palindrome(string $str): bool {
return $str === implode('', array_reverse(grapheme_str_split($str)));
}
$palindrome = 'satanoscillatemymetallicsonatas';
$polar_bear = "\u{1f43b}\u{200d}\u{2744}\u{fe0f}";
$palindrome = str_replace($palindrome, 'y', $polar_bear);
is_palindrome($palindrome);