public function MbString::convert in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/zendframework/zend-stdlib/src/StringWrapper/MbString.php \Zend\Stdlib\StringWrapper\MbString::convert()
Convert a string from defined encoding to the defined convert encoding
Parameters
string $str:
bool $reverse:
Return value
string|false
Overrides AbstractStringWrapper::convert
File
- vendor/
zendframework/ zend-stdlib/ src/ StringWrapper/ MbString.php, line 102
Class
Namespace
Zend\Stdlib\StringWrapperCode
public function convert($str, $reverse = false) {
$encoding = $this
->getEncoding();
$convertEncoding = $this
->getConvertEncoding();
if ($convertEncoding === null) {
throw new Exception\LogicException('No convert encoding defined');
}
if ($encoding === $convertEncoding) {
return $str;
}
$fromEncoding = $reverse ? $convertEncoding : $encoding;
$toEncoding = $reverse ? $encoding : $convertEncoding;
return mb_convert_encoding($str, $toEncoding, $fromEncoding);
}