src/Storage/Segment.php
public function write($uid, $mixed) {
        if (!is_int($uid) && !is_numeric($uid)) {
            throw new Exception\RuntimeException('Segment type key must integer or numeric.');
        }
        if (is_object($mixed) && method_exists($mixed, '__toString')) {
            $mixed = $mixed->__toString();
        }
        if (is_int($mixed) || is_float($mixed) || is_bool($mixed)) {
            $mixed = (string) $mixed;
        }
        if (!is_string($mixed)) {
            $mixed = '';
        }
        if ($uid * $this->blocSize >= $this->segmentSize) {
            throw new Exception\RuntimeException('Invalid access bloc. Only ' . floor($this->segmentSize / $this->blocSize) . ' blocs are allowed.');
        }
        $this->alloc();
        $limit = $this->getBlocSize();
        $str = mb_substr($mixed, 0, $limit);
        $str = str_pad($str, $this->blocSize);
        return shmop_write($this->memory, $str, $uid * $this->blocSize);
    }
public function write($uid, $mixed) {
        if (!is_int($uid) && !is_numeric($uid)) {
            throw new Exception\RuntimeException('Segment type key must integer or numeric.');
        }
        if (is_object($mixed) && method_exists($mixed, '__toString')) {
            $mixed = $mixed->__toString();
        }
        if (is_int($mixed) || is_float($mixed) || is_bool($mixed)) {
            $mixed = (string) $mixed;
        }
        if (!is_string($mixed)) {
            $mixed = '';
        }
        if ($uid * $this->blocSize >= $this->segmentSize) {
            throw new Exception\RuntimeException('Invalid access bloc. Only ' . floor($this->segmentSize / $this->blocSize) . ' blocs are allowed.');
        }
        $this->alloc();
        $limit = $this->getBlocSize();
        $str = mb_substr($mixed, 0, $limit);
        $str = str_pad($str, $this->blocSize);
        return shmop_write($this->memory, $str, $uid * $this->blocSize);
    }
public function write ( $ uid , $ mixed ) { if ( ! is_int ( $ uid ) && ! is_numeric ( $ uid ) ) { throw new Exception \ RuntimeException ( 'Segment type key must integer or numeric.' ) ; } if ( is_object ( $ mixed ) && method_exists ( $ mixed , '__toString' ) ) { $ mixed = $ mixed -> __toString ( ) ; } if ( is_int ( $ mixed ) || is_float ( $ mixed ) || is_bool ( $ mixed ) ) { $ mixed = ( string ) $ mixed ; } if ( ! is_string ( $ mixed ) ) { $ mixed = '' ; } if ( $ uid * $ this -> blocSize >= $ this -> segmentSize ) { throw new Exception \ RuntimeException ( 'Invalid access bloc. Only ' . floor ( $ this -> segmentSize / $ this -> blocSize ) . ' blocs are allowed.' ) ; } $ this -> alloc ( ) ; $ limit = $ this -> getBlocSize ( ) ; $ str = mb_substr ( $ mixed , 0 , $ limit ) ; $ str = str_pad ( $ str , $ this -> blocSize ) ; return shmop_write ( $ this -> memory , $ str , $ uid * $ this -> blocSize ) ; }
Write datas on $uid key
@param mixed $uid
@param mixed $mixed
Write datas on $uid key