How do I detect non-ASCII characters in a string?

前端 未结 9 2276
面向向阳花
面向向阳花 2020-12-01 07:56

If I have a PHP string, how can I determine if it contains at least one non-ASCII character or not, in an efficient way? And by non-ASCII character, I mean any character tha

9条回答
  •  再見小時候
    2020-12-01 08:11

    The function ctype_print returns true iff all characters fall into the ASCII range 32-126 (PHP unit test).

提交回复
热议问题