<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.ds-map.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'ds-map.get.php',
    1 => 'Ds\\Map::get',
    2 => 'Returns the value for a given key',
  ),
  'up' => 
  array (
    0 => 'class.ds-map.php',
    1 => 'Ds\\Map',
  ),
  'prev' => 
  array (
    0 => 'ds-map.first.php',
    1 => 'Ds\\Map::first',
  ),
  'next' => 
  array (
    0 => 'ds-map.haskey.php',
    1 => 'Ds\\Map::hasKey',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ds/ds/map/get.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="ds-map.get" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Ds\Map::get</h1>
  <p class="verinfo">(PECL ds &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Ds\Map::get</span> &mdash; <span class="dc-title">Returns the value for a given key</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-ds-map.get-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Ds\Map::get</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$key</code></span>, <span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$default</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>

  <p class="para rdfs-comment">
    Returns the value for a given key, or an optional default value if the key
    could not be found.
  </p>

  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
    <p class="para">
        Keys of type <span class="type"><a href="language.types.object.php" class="type object">object</a></span> are supported.

        If an object implements <span class="classname"><a href="class.ds-hashable.php" class="classname">Ds\Hashable</a></span>,
        equality will be determined by the object&#039;s <code class="code">equals</code> function.

        If an object does not implement <span class="classname"><a href="class.ds-hashable.php" class="classname">Ds\Hashable</a></span>,
        objects must be references to the same instance to be considered equal.
    </p>
  </p></blockquote>

  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
    <p class="para">
        You can also use array syntax to access values by key, eg. <code class="code">$map[&quot;key&quot;]</code>.
    </p>
  </p></blockquote>

  <div class="caution"><strong class="caution">Achtung</strong>
    <p class="para">
        Be careful when using array syntax. Scalar keys will be coerced to
        integers by the engine. For example, <code class="code">$map[&quot;1&quot;]</code> will attempt
        to access <code class="code">int(1)</code>, while <code class="code">$map-&gt;get(&quot;1&quot;)</code> will
        correctly look up the string key.
    </p>
    <p class="para">
        See <a href="language.types.array.php" class="link">Arrays</a>.
    </p>
  </div>

 </div>


 <div class="refsect1 parameters" id="refsect1-ds-map.get-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
    <dt><code class="parameter">key</code></dt>
    <dd>
     <p class="para">
        The key to look up.
     </p>
    </dd>
   
   
    <dt><code class="parameter">default</code></dt>
    <dd>
     <p class="para">
        The optional default value, returned if the key could not be found.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-ds-map.get-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
    The value mapped to the given <code class="parameter">key</code>, or the <code class="parameter">default</code>
    value if provided and the key could not be found in the map.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-ds-map.get-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <p class="para">
   <span class="classname"><a href="class.outofboundsexception.php" class="classname">OutOfBoundsException</a></span> if the key could not be found
   and a default value was not provided.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-ds-map.get-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="example-1">
   <p><strong>Beispiel #1 <span class="function"><strong>Ds\Map::get()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$map </span><span style="color: #007700">= new </span><span style="color: #0000BB">\Ds\Map</span><span style="color: #007700">([</span><span style="color: #DD0000">"a" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #DD0000">"b" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #DD0000">"c" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">3</span><span style="color: #007700">]);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$map</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #DD0000">"a"</span><span style="color: #007700">));       </span><span style="color: #FF8000">// 1<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$map</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #DD0000">"d"</span><span style="color: #007700">, </span><span style="color: #0000BB">10</span><span style="color: #007700">));   </span><span style="color: #FF8000">// 10 (default used)<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt
eine ähnliche Ausgabe wie:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">int(1)
int(10)</pre>
</div>
   </div>
  </div>
  <div class="example" id="example-2">
   <p><strong>Beispiel #2 <span class="function"><strong>Ds\Map::get()</strong></span> example using array syntax</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$map </span><span style="color: #007700">= new </span><span style="color: #0000BB">\Ds\Map</span><span style="color: #007700">([</span><span style="color: #DD0000">"a" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #DD0000">"b" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #DD0000">"c" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">3</span><span style="color: #007700">]);<br /><br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$map</span><span style="color: #007700">[</span><span style="color: #DD0000">"a"</span><span style="color: #007700">]); </span><span style="color: #FF8000">// 1<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt
eine ähnliche Ausgabe wie:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">int(1)</pre>
</div>
   </div>
  </div>
 </div>



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