3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* https://www.php.net/manual/en/function.ctype-print.php Returns true if every character in text will actually create output (including blanks). Returns false if text contains control characters or characters that do not have any output or control function at all. */ function ctype_print_utf(string $string): bool { return preg_match('/[[:cntrl:]]/', $string) === 0; } $items = ["Curaçao", "Curaçao\n"]; foreach ($items as $item) { var_dump($item, ctype_print_utf($item)); }

preferences:
31.25 ms | 405 KiB | 5 Q