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

前端 未结 9 2275
面向向阳花
面向向阳花 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:13

    I suggest you look into utf8_encode or utf8_decode under PHP's manual:

    http://www.php.net/manual/en/function.utf8-encode.php

    Look into the examples down below as it may have something there that leads you to the right direction if not finding what you are looking for.

提交回复
热议问题