<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.sem.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.shm-attach.php',
    1 => 'shm_attach',
    2 => 'Cr&eacute;e ou ouvre un segment de m&eacute;moire partag&eacute;e',
  ),
  'up' => 
  array (
    0 => 'ref.sem.php',
    1 => 'Fonctions S&eacute;maphore',
  ),
  'prev' => 
  array (
    0 => 'function.sem-remove.php',
    1 => 'sem_remove',
  ),
  'next' => 
  array (
    0 => 'function.shm-detach.php',
    1 => 'shm_detach',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/sem/functions/shm-attach.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.shm-attach" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">shm_attach</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">shm_attach</span> &mdash; <span class="dc-title">Crée ou ouvre un segment de mémoire partagée</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.shm-attach-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>shm_attach</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$key</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span> <code class="parameter">$size</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$permissions</code><span class="initializer"> = 0666</span></span>): <span class="type"><span class="type"><a href="class.sysvsharedmemory.php" class="type SysvSharedMemory">SysvSharedMemory</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="simpara">
   <span class="function"><strong>shm_attach()</strong></span> retourne une instance qui
   permettra d&#039;accéder à la mémoire partagée de type System V.
   Au premier appel, la mémoire sera
   créée, avec la taille <code class="parameter">size</code>
   et avec les permissions <code class="parameter">permissions</code>
  </p>
  <p class="simpara">
   Aux appels suivants avec la même clé
   <code class="parameter">key</code>, <span class="function"><strong>shm_attach()</strong></span>
   retournera une nouvelle instance, mais cette instance
   accédera toujours à la même portion de
   mémoire partagée. Dans ce cas, <code class="parameter">size</code>
   et <code class="parameter">permissions</code> seront ignorés.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.shm-attach-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <dl>
   
    <dt><code class="parameter">key</code></dt>
    <dd>
     <span class="simpara">
      Un identifiant numérique de la mémoire partagée
     </span>
    </dd>
   
   
    <dt><code class="parameter">size</code></dt>
    <dd>
     <span class="simpara">
      La taille mémoire. S&#039;il n&#039;est pas fourni, vaut par défaut
      la valeur de <code class="literal">sysvshm.init_mem</code> du fichier
      <var class="filename">php.ini</var>, sinon 10000 octets.
     </span>
    </dd>
   
   
    <dt><code class="parameter">permissions</code></dt>
    <dd>
     <span class="simpara">
      Les permissions (optionnelles). Par défaut, vaut 0666.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.shm-attach-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="simpara">
   Retourne une instance de <span class="classname"><a href="class.sysvsharedmemory.php" class="classname">SysvSharedMemory</a></span> en cas de succès,  ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si une erreur survient.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.shm-attach-changelog">
  <h3 class="title">Historique</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       En cas de succès, cette fonction retourne une instance de
       <span class="classname"><a href="class.sysvsharedmemory.php" class="classname">SysvSharedMemory</a></span> désormais; auparavant; une
       <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> était retournée.
      </td>
     </tr>

     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">size</code> est désormais nullable.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.shm-attach-seealso">
  <h3 class="title">Voir aussi</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.shm-detach.php" class="function" rel="rdfs-seeAlso">shm_detach()</a> - Lib&egrave;re un segment de m&eacute;moire partag&eacute;e</span></li>
   <li><span class="function"><a href="function.ftok.php" class="function" rel="rdfs-seeAlso">ftok()</a> - Convertit un chemin et un identifiant de projet en une cl&eacute; System V IPC</span></li>
  </ul>
 </div>

</div><?php manual_footer($setup); ?>