<!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>Write data into shared memory block</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.shmop-size.html">shmop_size</a></div> <div class="next" style="text-align: right; float: right;"><a href="refs.basic.other.html">Other Basic Extensions</a></div> <div class="up"><a href="ref.shmop.html">Shared Memory Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.shmop-write" class="refentry"> <div class="refnamediv"> <h1 class="refname">shmop_write</h1> <p class="verinfo">(PHP 4 >= 4.0.4, PHP 5)</p><p class="refpurpose"><span class="refname">shmop_write</span> — <span class="dc-title">Write data into shared memory block</span></p> </div> <div class="refsect1 description" id="refsect1-function.shmop-write-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><strong>shmop_write</strong></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$shmid</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$offset</code></span> )</div> <p class="para rdfs-comment"> <span class="function"><strong>shmop_write()</strong></span> will write a string into shared memory block. </p> </div> <div class="refsect1 parameters" id="refsect1-function.shmop-write-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">shmid</code></em></span> <dd> <p class="para"> The shared memory block identifier created by <span class="function"><a href="function.shmop-open.html" class="function">shmop_open()</a></span> </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">data</code></em></span> <dd> <p class="para"> A string to write into shared memory block </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">offset</code></em></span> <dd> <p class="para"> Specifies where to start writing data inside the shared memory segment. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.shmop-write-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The size of the written <em><code class="parameter">data</code></em>, or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 examples" id="refsect1-function.shmop-write-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-3728"> <p><strong>Example #1 Writing to shared memory block</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$shm_bytes_written </span><span style="color: #007700">= </span><span style="color: #0000BB">shmop_write</span><span style="color: #007700">(</span><span style="color: #0000BB">$shm_id</span><span style="color: #007700">, </span><span style="color: #0000BB">$my_string</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> <p class="para"> This example will write data inside <em>$my_string</em> into shared memory block, <em>$shm_bytes_written</em> will contain the number of bytes written. </p> </div> <div class="refsect1 seealso" id="refsect1-function.shmop-write-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.shmop-read.html" class="function" rel="rdfs-seeAlso">shmop_read()</a> - Read data from shared memory block</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.shmop-size.html">shmop_size</a></div> <div class="next" style="text-align: right; float: right;"><a href="refs.basic.other.html">Other Basic Extensions</a></div> <div class="up"><a href="ref.shmop.html">Shared Memory Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>