public function preceding(int $offset): string
    {
        $this->rewind();
        while ($this->valid()) {
            $previousElement = $this->getCurrentElement();
            $this->next();
            $currentElement = $this->getCurrentElement();
            if (($currentElement->getOffset() + $currentElement->getLength()) >= $offset) {
                return $previousElement->getOffset() + $previousElement->getLength();
            }
        }
        return $currentElement->getOffset() + $currentElement->getLength();
    }
public function preceding(int $offset): string
    {
        $this->rewind();
        while ($this->valid()) {
            $previousElement = $this->getCurrentElement();
            $this->next();
            $currentElement = $this->getCurrentElement();
            if (($currentElement->getOffset() + $currentElement->getLength()) >= $offset) {
                return $previousElement->getOffset() + $previousElement->getLength();
            }
        }
        return $currentElement->getOffset() + $currentElement->getLength();
    }
public function preceding ( int $ offset ) : string { $ this -> rewind ( ) ; while ( $ this -> valid ( ) ) { $ previousElement = $ this -> getCurrentElement ( ) ; $ this -> next ( ) ; $ currentElement = $ this -> getCurrentElement ( ) ; if ( ( $ currentElement -> getOffset ( ) + $ currentElement -> getLength ( ) ) >= $ offset ) { return $ previousElement -> getOffset ( ) + $ previousElement -> getLength ( ) ; } } return $ currentElement -> getOffset ( ) + $ currentElement -> getLength ( ) ; }
Returns the element preceding the character of the original string given by its offset

@param integer $offset The offset of the character
@return string The element preceding this character
Returns the element preceding the character of the original string given by its offset