<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Read data from the memory buffer based on offset and length. Or remove data from the memory buffer.</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="swoole-buffer.recycle.html">Swoole\Buffer::recycle</a></div> <div class="next" style="text-align: right; float: right;"><a href="swoole-buffer.tostring.html">Swoole\Buffer::__toString</a></div> <div class="up"><a href="class.swoole-buffer.html">Swoole\Buffer</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="swoole-buffer.substr" class="refentry"> <div class="refnamediv"> <h1 class="refname">Swoole\Buffer::substr</h1> <p class="verinfo">(PHP 5 >= 5.2.0, PHP 7, PECL swoole >= 1.9.0)</p><p class="refpurpose"><span class="refname">Swoole\Buffer::substr</span> — <span class="dc-title">Read data from the memory buffer based on offset and length. Or remove data from the memory buffer.</span></p> </div> <div class="refsect1 description" id="refsect1-swoole-buffer.substr-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><strong>Swoole\Buffer::substr</strong></span> ( <span class="methodparam"><span class="type">integer</span> <code class="parameter">$offset</code></span> [, <span class="methodparam"><span class="type">integer</span> <code class="parameter">$length</code></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$remove</code></span> ]] )</div> <p class="para rdfs-comment"> If $remove is set to be true and $offset is set to be 0, the data will be removed from the buffer. The memory for storing the data will be released when the buffer object is deconstructed. </p> </div> <div class="refsect1 parameters" id="refsect1-swoole-buffer.substr-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <code class="parameter">offset</code></dt> <dd> <p class="para"> The offset. </p> </dd> <dt> <code class="parameter">length</code></dt> <dd> <p class="para"> The length. </p> </dd> <dt> <code class="parameter">remove</code></dt> <dd> <p class="para"> Whether to remove the data from the memory buffer. </p> </dd> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-swoole-buffer.substr-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The data or string readed from the memory buffer. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="swoole-buffer.recycle.html">Swoole\Buffer::recycle</a></div> <div class="next" style="text-align: right; float: right;"><a href="swoole-buffer.tostring.html">Swoole\Buffer::__toString</a></div> <div class="up"><a href="class.swoole-buffer.html">Swoole\Buffer</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>