<?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 => 'zh', ), 'this' => array ( 0 => 'ds-map.first.php', 1 => 'Ds\\Map::first', 2 => 'Returns the first pair in the map', ), 'up' => array ( 0 => 'class.ds-map.php', 1 => 'Ds\\Map', ), 'prev' => array ( 0 => 'ds-map.filter.php', 1 => 'Ds\\Map::filter', ), 'next' => array ( 0 => 'ds-map.get.php', 1 => 'Ds\\Map::get', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ds/ds/map/first.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?> <div id="ds-map.first" class="refentry"> <div class="refnamediv"> <h1 class="refname">Ds\Map::first</h1> <p class="verinfo">(PECL ds >= 1.0.0)</p><p class="refpurpose"><span class="refname">Ds\Map::first</span> — <span class="dc-title">Returns the first pair in the map</span></p> </div> <div class="refsect1 description" id="refsect1-ds-map.first-description"> <h3 class="title">说明</h3> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><strong>Ds\Map::first</strong></span>(): <span class="type"><a href="class.ds-pair.php" class="type Ds\Pair">Ds\Pair</a></span></div> <p class="para rdfs-comment"> Returns the first pair in the map. </p> </div> <div class="refsect1 parameters" id="refsect1-ds-map.first-parameters"> <h3 class="title">参数</h3> <p class="para">此函数没有参数。</p> </div> <div class="refsect1 returnvalues" id="refsect1-ds-map.first-returnvalues"> <h3 class="title">返回值</h3> <p class="para"> The first pair in the map. </p> </div> <div class="refsect1 errors" id="refsect1-ds-map.first-errors"> <h3 class="title">错误/异常</h3> <p class="para"> <span class="classname"><a href="class.underflowexception.php" class="classname">UnderflowException</a></span> if empty. </p> </div> <div class="refsect1 examples" id="refsect1-ds-map.first-examples"> <h3 class="title">示例</h3> <div class="example" id="example-4352"> <p><strong>示例 #1 <span class="function"><strong>Ds\Map::first()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?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">=> </span><span style="color: #0000BB">1</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">, </span><span style="color: #DD0000">"c" </span><span style="color: #007700">=> </span><span style="color: #0000BB">3</span><span style="color: #007700">]);<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: #0000BB">first</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> <div class="example-contents"><p>以上示例的输出类似于:</p></div> <div class="example-contents screen"> <div class="examplescode"><pre class="examplescode">object(Ds\Pair)#2 (2) { ["key"]=> string(1) "a" ["value"]=> int(1) }</pre> </div> </div> </div> </div> </div><?php manual_footer($setup); ?>