public static function substr($string, $from, $length = null)
    {
        if (false === $encoding = mb_detect_encoding($string, null, true)) {
            return substr($string, $from, $length);
        }

        return mb_substr($string, $from, $length, $encoding);
    }
public static function substr($string, $from, $length = null)
    {
        if (false === $encoding = mb_detect_encoding($string, null, true)) {
            return substr($string, $from, $length);
        }

        return mb_substr($string, $from, $length, $encoding);
    }
public static function substr ( $ string , $ from , $ length = null ) { if ( false === $ encoding = mb_detect_encoding ( $ string , null , true ) ) { return substr ( $ string , $ from , $ length ) ; } return mb_substr ( $ string , $ from , $ length , $ encoding ) ; }
Returns the subset of a string, using mb_substr if it is available.

@param string   $string String to subset
@param int      $from   Start offset
@param int|null $length Length to read

@return string The string subset
Returns the subset of a string using mb_substr if it is available .