3v4l.org

run code in 300+ PHP versions simultaneously
<?php 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('y', $polar_bear, $palindrome); echo "$palindrome is" . (is_palindrome($palindrome) ? "" : " not") . " a palindrome";
Output for 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.5.1 - 8.5.2
Fatal error: Uncaught Error: Call to undefined function grapheme_str_split() in /in/PuVIl:4 Stack trace: #0 /in/PuVIl(10): is_palindrome('satanoscillatem...') #1 {main} thrown in /in/PuVIl on line 4
Process exited with code 255.
Output for 8.4.1 - 8.4.17, 8.5.0
satanoscillatem🐻‍❄️metallicsonatas is a palindrome

preferences:
58.66 ms | 407 KiB | 5 Q