Function utf8_is_ascii
Tests whether a string contains only 7bit ASCII bytes. You might use this to conditionally check whether a string needs handling as UTF-8 or not, potentially offering performance benefits by using the native PHP equivalent if it's just ASCII e.g.;
if ( utf8_is_ascii($someString) ) { // It's just ASCII - use the native PHP version $someString = strtolower($someString); } else { $someString = utf8_strtolower($someString); }
Parameters summary
string |
$str |
Return value summary
boolean
|
TRUE if it's all ASCII |