Home
My Account
About us
Products
Support Services
Buy online
Downloads
Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
PHP Manual
Swoole
Installing/Configuring
Predefined Constants
Swoole Functions
Swoole\Async
Swoole\Atomic
Swoole\Buffer
Swoole\Channel
Swoole\Client
Swoole\Connection\Iterator
Swoole\Coroutine
Swoole\Coroutine\Lock
Swoole\Event
Swoole\Exception
Swoole\Http\Client
Swoole\Http\Request
Swoole\Http\Response
Swoole\Http\Server
Swoole\Lock
Swoole\Mmap
Swoole\Module
Swoole\MySQL
Swoole\MySQL\Exception
Swoole\Process
Swoole\Redis\Server
Swoole\Runtime
Swoole\Serialize
Swoole\Server
Swoole\Table
Swoole\Timer
Swoole\WebSocket\Frame
Swoole\WebSocket\Server
Swoole\Atomic::sub
Swoole\Buffer::append
Swoole
Last updated: Mon, 26 Oct 2026
The Swoole\Buffer class
(PECL swoole >= 1.9.0)
Introduction
Class synopsis
class
Swoole\Buffer
{
/* Methods */
public
function
append
(
string
$data
):
int
public
function
clear
():
void
public
function
__destruct
():
void
public
function
expand
(
int
$size
):
int
public
function
read
(
int
$offset
,
int
$length
):
string
public
function
recycle
():
void
public
function
substr
(
int
$offset
,
int
$length
= ?
,
bool
$remove
= ?
):
string
public
function
__toString
():
string
public
function
write
(
int
$offset
,
string
$data
):
void
}
Table of Contents
Swoole\Buffer::append
— Append the string or binary data at the end of the memory buffer and return the new size of memory allocated.
Swoole\Buffer::clear
— Reset the memory buffer.
Swoole\Buffer::__construct
— Fixed size memory blocks allocation.
Swoole\Buffer::__destruct
— Destruct the Swoole memory buffer.
Swoole\Buffer::expand
— Expand the size of memory buffer.
Swoole\Buffer::read
— Read data from the memory buffer based on offset and length.
Swoole\Buffer::recycle
— Release the memory to OS which is not used by the memory buffer.
Swoole\Buffer::substr
— Read data from the memory buffer based on offset and length. Or remove data from the memory buffer.
Swoole\Buffer::__toString
— Get the string value of the memory buffer.
Swoole\Buffer::write
— Write data to the memory buffer. The memory allocated for the buffer will not be changed.
Swoole\Atomic::sub
Swoole\Buffer::append
Swoole
Last updated: Mon, 26 Oct 2026