src/Str.php
public function last($length = null) {
		if ($length === null) {
			$length = 1;
		}

		$offset = $this->length() - $length;

		$rawString = mb_substr($this->rawString, $offset, null, $this->charset);

		return new static($rawString, $this->charset);
	}
public function last($length = null) {
		if ($length === null) {
			$length = 1;
		}

		$offset = $this->length() - $length;

		$rawString = mb_substr($this->rawString, $offset, null, $this->charset);

		return new static($rawString, $this->charset);
	}
public function last ( $ length = null ) { if ( $ length === null ) { $ length = 1 ; } $ offset = $ this -> length ( ) - $ length ; $ rawString = mb_substr ( $ this -> rawString , $ offset , null , $ this -> charset ) ; return new static ( $ rawString , $ this -> charset ) ; }
Returns the last character or the specified number of characters from the end of this string

@param int|null $length the number of characters to return from the end (optional)
@return static a new instance of this class
Returns the last character or the specified number of characters from the end of this string