<!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>Sets the current active configuration setting of magic_quotes_runtime</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.set-include-path.html">set_include_path</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.set-time-limit.html">set_time_limit</a></div> <div class="up"><a href="ref.info.html">PHP Options/Info Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.set-magic-quotes-runtime" class="refentry"> <div class="refnamediv"> <h1 class="refname">set_magic_quotes_runtime</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">set_magic_quotes_runtime</span> — <span class="dc-title">Sets the current active configuration setting of magic_quotes_runtime</span></p> </div> <div class="refsect1 description" id="refsect1-function.set-magic-quotes-runtime-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>set_magic_quotes_runtime</strong></span> ( <span class="methodparam"><span class="type">bool</span> <code class="parameter">$new_setting</code></span> )</div> <p class="para rdfs-comment"> Set the current active configuration setting of <a href="info.configuration.html#ini.magic-quotes-runtime" class="link">magic_quotes_runtime</a>. </p> <div class="warning"><strong class="warning">Warning</strong><p class="simpara">This function has been <em class="emphasis">DEPRECATED</em> as of PHP 5.3.0. Relying on this feature is highly discouraged.</p></div> </div> <div class="refsect1 errors" id="refsect1-function.set-magic-quotes-runtime-errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para"> Since PHP 5.3 this function has been deprecated and will raise an E_DEPRECATED warning upon execution. Since PHP 5.4 this function will also raise an E_CORE_ERROR on trying to enable magic quotes. </p> </div> <div class="refsect1 parameters" id="refsect1-function.set-magic-quotes-runtime-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">new_setting</code></em></span> <dd> <p class="para"> <strong><code>FALSE</code></strong> for off, <strong><code>TRUE</code></strong> for on. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.set-magic-quotes-runtime-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 examples" id="refsect1-function.set-magic-quotes-runtime-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-521"> <p><strong>Example #1 <span class="function"><strong>set_magic_quotes_runtime()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// Create a temporary file pointer<br /></span><span style="color: #0000BB">$fp </span><span style="color: #007700">= </span><span style="color: #0000BB">tmpfile</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">// Write some data to the pointer<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #DD0000">'\'PHP\' is a Recursive acronym'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Without magic_quotes_runtime<br /></span><span style="color: #0000BB">rewind</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">set_magic_quotes_runtime</span><span style="color: #007700">(</span><span style="color: #0000BB">false</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #DD0000">'Without magic_quotes_runtime: ' </span><span style="color: #007700">. </span><span style="color: #0000BB">fread</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #0000BB">64</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// With magic_quotes_runtime<br /></span><span style="color: #0000BB">rewind</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">set_magic_quotes_runtime</span><span style="color: #007700">(</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #DD0000">'With magic_quotes_runtime: ' </span><span style="color: #007700">. </span><span style="color: #0000BB">fread</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">, </span><span style="color: #0000BB">64</span><span style="color: #007700">), </span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Clean up<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> Without magic_quotes_runtime: 'PHP' is a Recursive acronym With magic_quotes_runtime: \'PHP\' is a Recursive acronym </pre></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.set-magic-quotes-runtime-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.get-magic-quotes-gpc.html" class="function" rel="rdfs-seeAlso">get_magic_quotes_gpc()</a> - Gets the current configuration setting of magic_quotes_gpc</span></li> <li class="member"> <span class="function"><a href="function.get-magic-quotes-runtime.html" class="function" rel="rdfs-seeAlso">get_magic_quotes_runtime()</a> - Gets the current active configuration setting of magic_quotes_runtime</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.set-include-path.html">set_include_path</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.set-time-limit.html">set_time_limit</a></div> <div class="up"><a href="ref.info.html">PHP Options/Info Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>