cvs: phpdoc-es /reference/strings/functions stripslashes.xml
| From: | Javier Eguiluz | Date: | Wed, 29 Jun 2005 21:53:27 +0000 |
| Subject: | cvs: phpdoc-es /reference/strings/functions stripslashes.xml | ||
| Groups: | php.doc.es | ||
| Request: | Send a blank email to doc-es+get-950@lists.php.net to get a copy of this message | ||
javi Wed Jun 29 17:53:27 2005 EDT
Modified files:
/phpdoc-es/reference/strings/functions stripslashes.xml
Log:
- Añadido EN-Revision
- Pequeñas correcciones
http://cvs.php.net/diff.php/phpdoc-es/reference/strings/functions/stripslashes.xml?r1=1.2&r2=1.3&ty=u
Index: phpdoc-es/reference/strings/functions/stripslashes.xml
diff -u phpdoc-es/reference/strings/functions/stripslashes.xml:1.2
phpdoc-es/reference/strings/functions/stripslashes.xml:1.3
--- phpdoc-es/reference/strings/functions/stripslashes.xml:1.2 Sat Aug 17 09:04:36 2002
+++ phpdoc-es/reference/strings/functions/stripslashes.xml Wed Jun 29 17:53:23 2005
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- splitted from ./es/functions/strings.xml, last change in rev 1.7 -->
-<!-- last change to 'stripslashes' in en/ tree in rev 1.2 -->
+<!-- $Revision: 1.3 $ -->
+<!-- EN-Revision: 1.5 Maintainer: javi Status: ready -->
+<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.stripslashes">
<refnamediv>
<refname>stripslashes</refname>
@@ -12,15 +13,91 @@
<title>Descripción</title>
<methodsynopsis>
<type>string</type><methodname>stripslashes</methodname>
-
<methodparam><type>string</type><parameter>cad</parameter></methodparam>
+
<methodparam><type>string</type><parameter>cadena</parameter></methodparam>
</methodsynopsis>
<para>
- Devuelve una cadena con las barras invertidas eliminadas
- (<literal>\'</literal> se convierte en <literal>'</literal>,
- etc.). Las barras invertidas dobles se convierten en sencillas.
+ Devuelve una cadena con las barras invertidas eliminadas
+ (<literal>\'</literal> se convierte en <literal>'</literal>,
+ etc.). Las barras invertidas dobles (<literal>\\</literal>) se
+ convierten en sencillas (<literal>\</literal>).
+ </para>
+ <para>
+ Un ejemplo de uso de la función <function>stripslashes</function> es
+ cuando la directiva <link
linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link>
+ tiene un valor de <literal>on</literal> (que es su valor por defecto) y no se van
+ a insertar los datos en una base de datos o cualquier otro elemento que necesite
+ escapar los caracteres (por ejemplo, cuando se van a mostrar los datos de forma
+ directa en una página HTML).
+ </para>
+ <para>
+ <example>
+ <title>Ejemplo de <function>stripslashes</function></title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$cadena = "¿Te apellidas O\'reilly?";
+
+// La salida es: ¿Te apellidas O'reilly?
+echo stripslashes($cadena);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ <note>
+ <para>
+ <function>stripslashes</function> no es recursiva, por lo que que si se quiere
aplicar la
+ función a una matriz multi-dimensional, se debe emplear una función
recursiva.
+ </para>
+ </note>
+ <para>
+ <example>
+ <title>Uso de <function>stripslashes</function> con una
matriz</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+function stripslashes_recursiva($valor)
+{
+ $valor = is_array($valor) ?
+ array_map('stripslashes_recursiva', $valor) :
+ stripslashes($valor);
+
+ return $valor;
+}
+
+// Ejemplo
+$array = array("p\\'rueba", "prue\\'ba",
array("pru\\'eba", "prueb\\'a"));
+$array = stripslashes_recursiva($array);
+
+// Output
+print_r($array);
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+
+Array
+(
+ [0] => p'rueba
+ [1] => prue'ba
+ [2] => Array
+ (
+ [0] => pru'eba
+ [1] => prueb'a
+ )
+
+)
+]]>
+ </screen>
+ </example>
+ </para>
+ <para>
+ Para ver más información sobre "magic quotes", vea
<function>get_magic_quotes_gpc</function>.
</para>
<simpara>
- Vea también <function>addslashes</function>.
+ Vea también <function>addslashes</function> y
<function>get_magic_quotes_gpc</function>.
</simpara>
</refsect1>
</refentry>