public static function trySeek($stream, $offset, $whence = SEEK_SET)
    {
        $offset = (int) $offset;

        // If SEEK_SET, we can avoid a seek if we're at the right location.
        if ($whence === SEEK_SET && ftell($stream) === $offset) {
            return true;
        }

        return static::isSeekable($stream) && fseek($stream, $offset, $whence) === 0;
    }
public static function trySeek($stream, $offset, $whence = SEEK_SET)
    {
        $offset = (int) $offset;

        // If SEEK_SET, we can avoid a seek if we're at the right location.
        if ($whence === SEEK_SET && ftell($stream) === $offset) {
            return true;
        }

        return static::isSeekable($stream) && fseek($stream, $offset, $whence) === 0;
    }
public static function trySeek ( $ stream , $ offset , $ whence = SEEK_SET ) { $ offset = ( int ) $ offset ; // If SEEK_SET, we can avoid a seek if we're at the right location. if ( $ whence === SEEK_SET && ftell ( $ stream ) === $ offset ) { return true ; } return static :: isSeekable ( $ stream ) && fseek ( $ stream , $ offset , $ whence ) === 0 ; }
Tries to seek a stream.

@param resource $stream The stream.
@param int      $offset The offset.
@param int      $whence One of SEEK_SET, SEEK_CUR, SEEK_END.

@return bool True on success, false on failure.

@see fseek()
Tries to seek a stream .