public function read($offset, $length = 1)
    {
        $ret = '';
        $segno = floor($offset / $this->segsize);
        $sOffset = $offset % $this->segsize;
        while (true) {
            if (!isset($this->segments[$segno])) {
                if (!$this->open($segno)) {
                    goto ret;
                }
            }

            $ret .= shmop_read($this->segments[$segno], $sOffset, min($length - mb_orig_strlen($ret), $this->segsize));

            if (mb_orig_strlen($ret) >= $length) {
                goto ret;
            }

            ++$segno;

            $sOffset = 0;
        }
        ret:

        return $ret === '' ? false : $ret;
    }
public function read($offset, $length = 1)
    {
        $ret = '';
        $segno = floor($offset / $this->segsize);
        $sOffset = $offset % $this->segsize;
        while (true) {
            if (!isset($this->segments[$segno])) {
                if (!$this->open($segno)) {
                    goto ret;
                }
            }

            $ret .= shmop_read($this->segments[$segno], $sOffset, min($length - mb_orig_strlen($ret), $this->segsize));

            if (mb_orig_strlen($ret) >= $length) {
                goto ret;
            }

            ++$segno;

            $sOffset = 0;
        }
        ret:

        return $ret === '' ? false : $ret;
    }
public function read ( $ offset , $ length = 1 ) { $ ret = '' ; $ segno = floor ( $ offset / $ this -> segsize ) ; $ sOffset = $ offset % $ this -> segsize ; while ( true ) { if ( ! isset ( $ this -> segments [ $ segno ] ) ) { if ( ! $ this -> open ( $ segno ) ) { goto ret ; } } $ ret .= shmop_read ( $ this -> segments [ $ segno ] , $ sOffset , min ( $ length - mb_orig_strlen ( $ ret ) , $ this -> segsize ) ) ; if ( mb_orig_strlen ( $ ret ) >= $ length ) { goto ret ; } ++ $ segno ; $ sOffset = 0 ; } ret : return $ ret === '' ? false : $ ret ; }
Read from shared memory
@param  integer $offset Offset
@param  integer $length Length
@return string          Data
Read from shared memory