downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.override-function.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.apd.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.override-function.php',
   
1 => 'override_function',
  ),
 
'up' =>
  array (
   
0 => 'ref.apd.php',
   
1 => 'APD Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.apd-set-session.php',
   
1 => 'apd_set_session',
  ),
 
'next' =>
  array (
   
0 => 'function.rename-function.php',
   
1 => 'rename_function',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.override-function" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">override_function</h1>
  <p class="verinfo">(PECL apd &gt;= 0.2)</p><p class="refpurpose"><span class="refname">override_function</span> &mdash; <span class="dc-title">Overrides built-in functions</span></p>

 </div>
 <a name="function.override-function.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><b>override_function</b></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$function_name</tt></span>
   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$function_args</tt></span>
   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$function_code</tt></span>
   )</div>

  <p class="para rdfs-comment">
   Overrides built-in functions by replacing them in the symbol table.
  </p>
 </div>



 <a name="function.override-function.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">function_name</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The function to override.
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">function_args</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The function arguments, as a coma separated string.
      </p>
      <p class="para">
       Usually you will want to pass this parameter, as well as the
       <i><tt class="parameter">function_code</tt></i>
 parameter, as a single quote
       delimited string. The reason for using single quoted strings, is to
       protect the variable names from parsing, otherwise, if you use double
       quotes there will be a need to escape the variable names, e.g.
       \<var class="varname">$your_var</var>.
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">function_code</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The new code for the function.
      </p>
     </dd>

   
   </dl>
<p>
  </p>
 </div>


 <a name="function.override-function.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <b><tt class="constant">TRUE</tt></b> on success or <b><tt class="constant">FALSE</tt></b> on failure.
  </p>
 </div>

 
 <a name="function.override-function.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 <b>override_function()</b> example</b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />override_function</span><span style="color: #007700">(</span><span style="color: #DD0000">'test'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'$a,$b'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'echo&nbsp;"DOING&nbsp;TEST";&nbsp;return&nbsp;$a&nbsp;*&nbsp;$b;'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div><p>
  </p>
 </div>

</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites