You are here

public static function StringUtils::isValidUtf8 in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-stdlib/src/StringUtils.php \Zend\Stdlib\StringUtils::isValidUtf8()

Check if a given string is valid UTF-8 encoded

Parameters

string $str:

Return value

bool

File

vendor/zendframework/zend-stdlib/src/StringUtils.php, line 168

Class

StringUtils
Utility class for handling strings of different character encodings using available PHP extensions.

Namespace

Zend\Stdlib

Code

public static function isValidUtf8($str) {
  return is_string($str) && ($str === '' || preg_match('/^./su', $str) == 1);
}