<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.recursivearrayiterator.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'recursivearrayiterator.haschildren.php',
    1 => 'RecursiveArrayIterator::hasChildren',
    2 => 'Returns whether current entry is an array or an object',
  ),
  'up' => 
  array (
    0 => 'class.recursivearrayiterator.php',
    1 => 'RecursiveArrayIterator',
  ),
  'prev' => 
  array (
    0 => 'recursivearrayiterator.getchildren.php',
    1 => 'RecursiveArrayIterator::getChildren',
  ),
  'next' => 
  array (
    0 => 'class.recursivecachingiterator.php',
    1 => 'RecursiveCachingIterator',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/spl/recursivearrayiterator/haschildren.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="recursivearrayiterator.haschildren" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">RecursiveArrayIterator::hasChildren</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">RecursiveArrayIterator::hasChildren</span> &mdash; <span class="dc-title">Returns whether current entry is an array or an object</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-recursivearrayiterator.haschildren-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>RecursiveArrayIterator::hasChildren</strong></span>(): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Returns whether current entry is an <span class="type"><a href="language.types.array.php" class="type array">array</a></span> or an <span class="type"><a href="language.types.object.php" class="type object">object</a></span> for
   which an iterator can be obtained via
   <span class="methodname"><a href="recursivearrayiterator.getchildren.php" class="methodname">RecursiveArrayIterator::getChildren()</a></span>.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-recursivearrayiterator.haschildren-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">У цієї функції немає
параметрів.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-recursivearrayiterator.haschildren-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> if the current entry is an <span class="type"><a href="language.types.array.php" class="type array">array</a></span> or an <span class="type"><a href="language.types.object.php" class="type object">object</a></span>,
   otherwise <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> is returned.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-recursivearrayiterator.haschildren-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 <span class="function"><strong>RecursiveArrayIterator::hasChildren()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$fruits </span><span style="color: #007700">= array(</span><span style="color: #DD0000">"a" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"lemon"</span><span style="color: #007700">, </span><span style="color: #DD0000">"b" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"orange"</span><span style="color: #007700">, array(</span><span style="color: #DD0000">"a" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"apple"</span><span style="color: #007700">, </span><span style="color: #DD0000">"p" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"pear"</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">$iterator </span><span style="color: #007700">= new </span><span style="color: #0000BB">RecursiveArrayIterator</span><span style="color: #007700">(</span><span style="color: #0000BB">$fruits</span><span style="color: #007700">);<br /><br />while (</span><span style="color: #0000BB">$iterator</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">valid</span><span style="color: #007700">()) {<br /><br />    </span><span style="color: #FF8000">// Check if there are children<br />    </span><span style="color: #007700">if (</span><span style="color: #0000BB">$iterator</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">hasChildren</span><span style="color: #007700">()) {<br />        </span><span style="color: #FF8000">// print all children<br />        </span><span style="color: #007700">foreach (</span><span style="color: #0000BB">$iterator</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getChildren</span><span style="color: #007700">() as </span><span style="color: #0000BB">$key </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$value</span><span style="color: #007700">) {<br />            echo </span><span style="color: #0000BB">$key </span><span style="color: #007700">. </span><span style="color: #DD0000">' : ' </span><span style="color: #007700">. </span><span style="color: #0000BB">$value </span><span style="color: #007700">. </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />        }<br />    } else {<br />        echo </span><span style="color: #DD0000">"No children.\n"</span><span style="color: #007700">;<br />    }<br /><br />    </span><span style="color: #0000BB">$iterator</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">next</span><span style="color: #007700">();<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Поданий вище приклад
виведе:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">No children.
No children.
a : apple
p : pear</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-recursivearrayiterator.haschildren-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="recursivearrayiterator.getchildren.php" class="function" rel="rdfs-seeAlso">RecursiveArrayIterator::getChildren()</a> - Returns an iterator for the current entry if it is an array or an object</span></li>
   </ul>
  </p>
 </div>


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