<!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>Construct a Swish object</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.swish.html">Swish Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="swish.getmetalist.html">Swish::getMetaList</a></div> <div class="up"><a href="ref.swish.html">Swish Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="swish.construct" class="refentry"> <div class="refnamediv"> <h1 class="refname">Swish::__construct</h1> <p class="verinfo">(PECL swish >= 0.1.0)</p><p class="refpurpose"><span class="refname">Swish::__construct</span> — <span class="dc-title">Construct a Swish object</span></p> </div> <div class="refsect1 description" id="refsect1-swish.construct-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>Swish::__construct</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$index_names</code></span> )</div> <div class="warning"><strong class="warning">Warning</strong><p class="simpara">This function is <em class="emphasis">EXPERIMENTAL</em>. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. </p></div> </div> <div class="refsect1 parameters" id="refsect1-swish.construct-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter">index_names</code></dt> <dd> <p class="para"> The list of index files separated by spaces. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-swish.construct-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> No value is returned. </p> </div> <div class="refsect1 errors" id="refsect1-swish.construct-errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para"> Throws <strong class="classname">SwishException</strong> on error. </p> </div> <div class="refsect1 examples" id="refsect1-swish.construct-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-5925"> <p><strong>Example #1 A <span class="function"><strong>Swish::__construct()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br /></span><span style="color: #007700">try {<br /> </span><span style="color: #0000BB">$swish </span><span style="color: #007700">= new </span><span style="color: #0000BB">Swish</span><span style="color: #007700">(</span><span style="color: #DD0000">"index1 index2"</span><span style="color: #007700">);<br />} catch (</span><span style="color: #0000BB">SwishException $e</span><span style="color: #007700">) {<br /> echo </span><span style="color: #0000BB">$e</span><span style="color: #007700">-></span><span style="color: #0000BB">getMessage</span><span style="color: #007700">(), </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /><br />foreach (</span><span style="color: #0000BB">$swish</span><span style="color: #007700">-></span><span style="color: #0000BB">indexes </span><span style="color: #007700">as </span><span style="color: #0000BB">$index</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$index</span><span style="color: #007700">[</span><span style="color: #DD0000">"name"</span><span style="color: #007700">]);<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$index</span><span style="color: #007700">[</span><span style="color: #DD0000">"headers"</span><span style="color: #007700">][</span><span style="color: #DD0000">"Total Words"</span><span style="color: #007700">]);<br />}<br /><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> string(6) "index1" int(1888) string(6) "index2" int(2429) </pre></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="ref.swish.html">Swish Functions</a></div> <div class="next" style="text-align: right; float: right;"><a href="swish.getmetalist.html">Swish::getMetaList</a></div> <div class="up"><a href="ref.swish.html">Swish Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>