philip Fri Jun 6 13:09:00 2003 EDT
Modified files:
/phpdoc/en/reference/info/functions get-magic-quotes-gpc.xml
Log:
Added example.
Index: phpdoc/en/reference/info/functions/get-magic-quotes-gpc.xml
diff -u phpdoc/en/reference/info/functions/get-magic-quotes-gpc.xml:1.5
phpdoc/en/reference/info/functions/get-magic-quotes-gpc.xml:1.6
--- phpdoc/en/reference/info/functions/get-magic-quotes-gpc.xml:1.5 Thu Mar 13
09:11:58 2003
+++ phpdoc/en/reference/info/functions/get-magic-quotes-gpc.xml Fri Jun 6 13:09:00
2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/info.xml, last change in rev 1.2 -->
<refentry id="function.get-magic-quotes-gpc">
<refnamediv>
@@ -34,6 +34,29 @@
Keep in mind that <link linkend="ini.magic-quotes-gpc">
magic_quotes_gpc</link> can not be set at runtime.
</simpara>
+ <para>
+ <example>
+ <title>Example use of <function>get_magic_quotes_gpc</function></title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+echo get_magic_quotes_gpc(); // 1
+echo $_POST['lastname']; // O\'reilly
+echo addslashes($_POST['lastname']); // O\\\'reilly
+
+if (!get_magic_quotes_gpc()) {
+ $lastname = addslashes($_POST['lastname']);
+} else {
+ $lastname = $_POST['lastname'];
+}
+
+echo $lastname; // O\'reilly
+$sql = "INSERT INTO lastnames (lastname) VALUES ('$lastname')";
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
<simpara>
See also <function>addslashes</function>,
<function>stripslashes</function>,
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php