WC_Geo_IP::_safe_substr()
Encode string.
Method of the class: WC_Geo_IP{}
No Hooks.
Return
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 9.7.1
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; }