How to check if a character is not in specific range of ASCII table in PHP

1 Answer

0 votes
$ch = 'z';

if (!(ord($ch) >= 32 && ord($ch) <= 126)) {
    echo "$ch - Not in range";
}

$ch = 'έ';
if (!(ord($ch) >= 32 && ord($ch) <= 126)) {
    echo "$ch - Not in range";
}




/*
run:

έ - Not in range

*/

 



answered May 30, 2022 by avibootz

Related questions

...