public static function substr($str, $start, $length = null)
    {
        if (function_exists('mb_substr')) {
            return mb_substr($str, $start, $length, 'utf-8');
        }
        if ($length === null) {
            return substr($str, $start);
        }
        return substr($str, $start, $length);
    }
public static function substr($str, $start, $length = null)
    {
        if (function_exists('mb_substr')) {
            return mb_substr($str, $start, $length, 'utf-8');
        }
        if ($length === null) {
            return substr($str, $start);
        }
        return substr($str, $start, $length);
    }
public static function substr ( $ str , $ start , $ length = null ) { if ( function_exists ( 'mb_substr' ) ) { return mb_substr ( $ str , $ start , $ length , 'utf-8' ) ; } if ( $ length === null ) { return substr ( $ str , $ start ) ; } return substr ( $ str , $ start , $ length ) ; }
Creates a sub string.
This function will attempt to use PHP's `mbstring` functions if they are available.
This function also forces utf-8 encoding.

@since Symphony 2.5.0
@param string $str
the string to operate on
@param int $start
the starting offset
@param int $length
the length of the substring
@return string
the resulting substring
Creates a sub string . This function will attempt to use PHP s mbstring functions if they are available . This function also forces utf - 8 encoding .