<!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>Exports a class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="reflectionclass.construct.html">ReflectionClass::__construct</a></div> <div class="next" style="text-align: right; float: right;"><a href="reflectionclass.getconstant.html">ReflectionClass::getConstant</a></div> <div class="up"><a href="class.reflectionclass.html">ReflectionClass</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="reflectionclass.export" class="refentry"> <div class="refnamediv"> <h1 class="refname">ReflectionClass::export</h1> <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">ReflectionClass::export</span> — <span class="dc-title">Exports a class</span></p> </div> <div class="refsect1 description" id="refsect1-reflectionclass.export-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="modifier">static</span> <span class="type">string</span> <span class="methodname"><strong>ReflectionClass::export</strong></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$argument</code></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$return</code><span class="initializer"> = false</span></span> ] )</div> <p class="para rdfs-comment"> Exports a reflected class. </p> </div> <div class="refsect1 parameters" id="refsect1-reflectionclass.export-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">argument</code></em></span> <dd> <p class="para"> The reflection to export. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">return</code></em></span> <dd> <p class="para"> Setting to <strong><code>TRUE</code></strong> will return the export, as opposed to emitting it. Setting to <strong><code>FALSE</code></strong> (the default) will do the opposite. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-reflectionclass.export-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> If the <em><code class="parameter">return</code></em> parameter is set to <strong><code>TRUE</code></strong>, then the export is returned as a <span class="type"><a href="language.types.string.html" class="type string">string</a></span>, otherwise <strong><code>NULL</code></strong> is returned. </p> </div> <div class="refsect1 examples" id="refsect1-reflectionclass.export-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-5181"> <p><strong>Example #1 Basic usage of <span class="methodname"><strong>ReflectionClass::export()</strong></span></strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">Apple </span><span style="color: #007700">{<br /> public </span><span style="color: #0000BB">$var1</span><span style="color: #007700">;<br /> public </span><span style="color: #0000BB">$var2 </span><span style="color: #007700">= </span><span style="color: #DD0000">'Orange'</span><span style="color: #007700">;<br /><br /> public function </span><span style="color: #0000BB">type</span><span style="color: #007700">() {<br /> return </span><span style="color: #DD0000">'Apple'</span><span style="color: #007700">;<br /> }<br />}<br /></span><span style="color: #0000BB">ReflectionClass</span><span style="color: #007700">::</span><span style="color: #0000BB">export</span><span style="color: #007700">(</span><span style="color: #DD0000">'Apple'</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 something similar to:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> Class [ <user> class Apple ] { @@ php shell code 1-8 - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [2] { Property [ <default> public $var1 ] Property [ <default> public $var2 ] } - Methods [1] { Method [ <user> public method type ] { @@ php shell code 5 - 7 } } } </pre></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-reflectionclass.export-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="methodname"><a href="reflectionclass.getname.html" class="methodname" rel="rdfs-seeAlso">ReflectionClass::getName()</a> - Gets class name</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="reflectionclass.construct.html">ReflectionClass::__construct</a></div> <div class="next" style="text-align: right; float: right;"><a href="reflectionclass.getconstant.html">ReflectionClass::getConstant</a></div> <div class="up"><a href="class.reflectionclass.html">ReflectionClass</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>