src/StringType.php
public function substr($from, $length = null)
    {
        $from = Cast::Int($from);
        $length = Cast::_Int($length);

        if ($this->length() < $from) {
            throw new LengthException('From parameter must be smaller than the length of the string');
        }

        if ($this->length() < $length) {
            throw new LengthException('Length parameter must be smaller than the length of the string');
        }

        return mb_convert_encoding(mb_substr($this->value, $from, $length, 'UTF-8'), $this->encoding, 'UTF-8');
    }
public function substr($from, $length = null)
    {
        $from = Cast::Int($from);
        $length = Cast::_Int($length);

        if ($this->length() < $from) {
            throw new LengthException('From parameter must be smaller than the length of the string');
        }

        if ($this->length() < $length) {
            throw new LengthException('Length parameter must be smaller than the length of the string');
        }

        return mb_convert_encoding(mb_substr($this->value, $from, $length, 'UTF-8'), $this->encoding, 'UTF-8');
    }
public function substr ( $ from , $ length = null ) { $ from = Cast :: Int ( $ from ) ; $ length = Cast :: _Int ( $ length ) ; if ( $ this -> length ( ) < $ from ) { throw new LengthException ( 'From parameter must be smaller than the length of the string' ) ; } if ( $ this -> length ( ) < $ length ) { throw new LengthException ( 'Length parameter must be smaller than the length of the string' ) ; } return mb_convert_encoding ( mb_substr ( $ this -> value , $ from , $ length , 'UTF-8' ) , $ this -> encoding , 'UTF-8' ) ; }
Substring

@param  int $from
@param  int $length
@return string|null
Substring