<!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>Process a PHP file importing function and class definitions, overwriting where appropriate</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.runkit-function-rename.html">runkit_function_rename</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.runkit-lint-file.html">runkit_lint_file</a></div> <div class="up"><a href="ref.runkit.html">runkit Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.runkit-import" class="refentry"> <div class="refnamediv"> <h1 class="refname">runkit_import</h1> <p class="verinfo">(PECL runkit >= 0.7.0)</p><p class="refpurpose"><span class="refname">runkit_import</span> — <span class="dc-title"> Process a PHP file importing function and class definitions, overwriting where appropriate </span></p> </div> <div class="refsect1 description" id="refsect1-function.runkit-import-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>runkit_import</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = RUNKIT_IMPORT_CLASS_METHODS</span></span> ] )</div> <p class="para rdfs-comment"> Similar to <span class="function"><a href="function.include.html" class="function">include</a></span> however any code residing outside of a function or class is simply ignored. Additionally, depending on the value of <code class="parameter">flags</code>, any functions or classes which already exist in the currently running environment may be automatically overwritten by their new definitions. </p> </div> <div class="refsect1 parameters" id="refsect1-function.runkit-import-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter">filename</code></dt> <dd> <p class="para"> Filename to import function and class definitions from </p> </dd> <dt> <code class="parameter">flags</code></dt> <dd> <p class="para"> Bitwise OR of the <a href="runkit.constants.html" class="link"><em>RUNKIT_IMPORT_*</em> family of constants</a>. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.runkit-import-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.runkit-import-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-586"> <p><strong>Example #1 <span class="function"><strong>runkit_import()</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">// import classes entirely<br /></span><span style="color: #0000BB">runkit_import</span><span style="color: #007700">(</span><span style="color: #DD0000">'myfile.inc'</span><span style="color: #007700">, </span><span style="color: #0000BB">RUNKIT_IMPORT_CLASSES</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* import classes, but not imports their static properties<br /> (RUNKIT_IMPORT_CLASS_STATIC_PROPS is available since 1.0.1) */<br /></span><span style="color: #0000BB">runkit_import</span><span style="color: #007700">(</span><span style="color: #DD0000">'myfile.inc'</span><span style="color: #007700">, </span><span style="color: #0000BB">RUNKIT_IMPORT_CLASSES </span><span style="color: #007700">& ~</span><span style="color: #0000BB">RUNKIT_IMPORT_CLASS_STATIC_PROPS</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* import only static properties of classes<br /> (RUNKIT_IMPORT_CLASS_STATIC_PROPS is available since 1.0.1) */<br /></span><span style="color: #0000BB">runkit_import</span><span style="color: #007700">(</span><span style="color: #DD0000">'myfile.inc'</span><span style="color: #007700">, </span><span style="color: #0000BB">RUNKIT_IMPORT_CLASS_STATIC_PROPS</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.runkit-function-rename.html">runkit_function_rename</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.runkit-lint-file.html">runkit_lint_file</a></div> <div class="up"><a href="ref.runkit.html">runkit Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>