<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.strings.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.stripslashes.php',
    1 => 'stripslashes',
    2 => 'Supprime les antislashs d\'une cha&icirc;ne',
  ),
  'up' => 
  array (
    0 => 'ref.strings.php',
    1 => 'Fonctions sur les cha&icirc;nes de caract&egrave;res',
  ),
  'prev' => 
  array (
    0 => 'function.stripos.php',
    1 => 'stripos',
  ),
  'next' => 
  array (
    0 => 'function.stristr.php',
    1 => 'stristr',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/strings/functions/stripslashes.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.stripslashes" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">stripslashes</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">stripslashes</span> &mdash; <span class="dc-title">Supprime les antislashs d&#039;une chaîne</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.stripslashes-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>stripslashes</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$string</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Supprime les antislashs d&#039;une chaîne.
  </p>
  <p class="para">
   <span class="function"><strong>stripslashes()</strong></span> peut être utilisé si l&#039;on n&#039;insère pas
   ces données dans un endroit (tel qu&#039;une base de données) qui nécessite
   l&#039;échappement. Par exemple, si l&#039;on affiche simplement et directement
   des données provenant d&#039;un formulaire HTML.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.stripslashes-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">string</code></dt>
     <dd>
      <p class="para">
       La chaîne d&#039;entrée.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.stripslashes-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne une chaîne dont les antislashs ont été supprimés.
   <code class="literal">\&#039;</code> devient <code class="literal">&#039;</code>, etc.
   Les doubles antislashs (<code class="literal">\\</code>) sont réduits
   à un seul antislash (<code class="literal">\</code>).
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.stripslashes-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec <span class="function"><strong>stripslashes()</strong></span></strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$str </span><span style="color: #007700">= </span><span style="color: #DD0000">"Avez-vous l\'oreille dure?"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Affiche : Avez-vous l'oreille dure?<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">stripslashes</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    <span class="function"><strong>stripslashes()</strong></span> n&#039;est pas récursif. Pour
    appliquer cette fonction à un tableau multidimensionnel, il faut
    utiliser une fonction récursive.
   </p>
  </p></blockquote>
  <p class="para">
   <div class="example" id="example-2">
    <p><strong>Exemple #2 Utilisation de <span class="function"><strong>stripslashes()</strong></span> sur un tableau</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">stripslashes_deep</span><span style="color: #007700">(</span><span style="color: #0000BB">$value</span><span style="color: #007700">)<br />{<br />    </span><span style="color: #0000BB">$value </span><span style="color: #007700">= </span><span style="color: #0000BB">is_array</span><span style="color: #007700">(</span><span style="color: #0000BB">$value</span><span style="color: #007700">) ?<br />                </span><span style="color: #0000BB">array_map</span><span style="color: #007700">(</span><span style="color: #DD0000">'stripslashes_deep'</span><span style="color: #007700">, </span><span style="color: #0000BB">$value</span><span style="color: #007700">) :<br />                </span><span style="color: #0000BB">stripslashes</span><span style="color: #007700">(</span><span style="color: #0000BB">$value</span><span style="color: #007700">);<br /><br />    return </span><span style="color: #0000BB">$value</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #FF8000">// Exemple<br /></span><span style="color: #0000BB">$array </span><span style="color: #007700">= array(</span><span style="color: #DD0000">"f\\'oo"</span><span style="color: #007700">, </span><span style="color: #DD0000">"b\\'ar"</span><span style="color: #007700">, array(</span><span style="color: #DD0000">"fo\\'o"</span><span style="color: #007700">, </span><span style="color: #DD0000">"b\\'ar"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$array </span><span style="color: #007700">= </span><span style="color: #0000BB">stripslashes_deep</span><span style="color: #007700">(</span><span style="color: #0000BB">$array</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Affiche<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$array</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>L&#039;exemple ci-dessus va afficher :</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">Array
(
    [0] =&gt; f&#039;oo
    [1] =&gt; b&#039;ar
    [2] =&gt; Array
        (
            [0] =&gt; fo&#039;o
            [1] =&gt; b&#039;ar
        )

)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.stripslashes-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.addslashes.php" class="function" rel="rdfs-seeAlso">addslashes()</a> - Ajoute des antislashs dans une cha&icirc;ne</span></li>
    <li><span class="function"><a href="function.get-magic-quotes-gpc.php" class="function" rel="rdfs-seeAlso">get_magic_quotes_gpc()</a> - Retourne la configuration actuelle de l'option magic_quotes_gpc</span></li>
   </ul>
  </p>
 </div>


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