WC_Geo_IP::_safe_substr
Encode string.
Method of the class: WC_Geo_IP{}
No Hooks.
Returns
String.
Usage
// private - for code of main (parent) class only $result = $this->_safe_substr( $string, $start, $length );
- $string(string) (required)
- .
- $start(int) (required)
- .
- $length(int) (required)
- .
WC_Geo_IP::_safe_substr() WC Geo IP:: safe substr code WC 10.6.2
private function _safe_substr( $string, $start, $length ) {
// workaround php's broken substr, strpos, etc handling with
// mbstring.func_overload and mbstring.internal_encoding
$mb_exists = extension_loaded( 'mbstring' );
if ( $mb_exists ) {
$enc = mb_internal_encoding();
mb_internal_encoding( 'ISO-8859-1' );
}
$buf = substr( $string, $start, $length );
if ( $mb_exists ) {
mb_internal_encoding( $enc );
}
return $buf;
}