<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.ds.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'ds.examples.php',
    1 => 'Examples',
    2 => 'Examples',
  ),
  'up' => 
  array (
    0 => 'book.ds.php',
    1 => 'Data Structures',
  ),
  'prev' => 
  array (
    0 => 'ds.installation.php',
    1 => 'Installation',
  ),
  'next' => 
  array (
    0 => 'class.ds-collection.php',
    1 => 'Ds\\Collection',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ds/examples.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="ds.examples" class="chapter">
 <h1 class="title">Examples</h1>

 <div class="example" id="example-1">
  <p><strong>Example #1 Vector</strong></p>
  <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$vector </span><span style="color: #007700">= new </span><span style="color: #0000BB">\Ds\Vector</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$vector</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">push</span><span style="color: #007700">(</span><span style="color: #DD0000">'a'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$vector</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">push</span><span style="color: #007700">(</span><span style="color: #DD0000">'b'</span><span style="color: #007700">, </span><span style="color: #DD0000">'c'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$vector</span><span style="color: #007700">[] = </span><span style="color: #DD0000">'d'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$vector</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</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>
Ds\Vector Object
(
    [0] =&gt; a
    [1] =&gt; b
    [2] =&gt; c
    [3] =&gt; d
)
</pre></div>
  </div>
 </div>
 <div class="example" id="example-2">
  <p><strong>Example #2 Map</strong></p>
  <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$map </span><span style="color: #007700">= new </span><span style="color: #0000BB">\Ds\Map</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$map</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">put</span><span style="color: #007700">(</span><span style="color: #DD0000">'a'</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$map</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">put</span><span style="color: #007700">(</span><span style="color: #DD0000">'b'</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$map</span><span style="color: #007700">[</span><span style="color: #DD0000">'c'</span><span style="color: #007700">] = </span><span style="color: #0000BB">3</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$map</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</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>
Ds\Map Object
(
    [0] =&gt; Ds\Pair Object
        (
            [key] =&gt; a
            [value] =&gt; 1
        )

    [1] =&gt; Ds\Pair Object
        (
            [key] =&gt; b
            [value] =&gt; 2
        )

    [2] =&gt; Ds\Pair Object
        (
            [key] =&gt; c
            [value] =&gt; 3
        )

)
</pre></div>
  </div>
 </div>
</div>
<?php manual_footer($setup); ?>