<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.simplexmlelement.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'simplexmlelement.current.php',
    1 => 'SimpleXMLElement::current',
    2 => '現在の要素を返す',
  ),
  'up' => 
  array (
    0 => 'class.simplexmlelement.php',
    1 => 'SimpleXMLElement',
  ),
  'prev' => 
  array (
    0 => 'simplexmlelement.count.php',
    1 => 'SimpleXMLElement::count',
  ),
  'next' => 
  array (
    0 => 'simplexmlelement.getdocnamespaces.php',
    1 => 'SimpleXMLElement::getDocNamespaces',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/simplexml/simplexmlelement/current.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="simplexmlelement.current" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SimpleXMLElement::current</h1>
  <p class="verinfo">(PHP 8)</p><p class="refpurpose"><span class="refname">SimpleXMLElement::current</span> &mdash; <span class="dc-title">現在の要素を返す</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-simplexmlelement.current-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>SimpleXMLElement::current</strong></span>(): <span class="type"><a href="class.simplexmlelement.php" class="type SimpleXMLElement">SimpleXMLElement</a></span></div>


  <div class="warning"><strong class="warning">警告</strong>
   <p class="simpara">
    PHP 8.0 より前のバージョンでは、
    <span class="methodname"><strong>SimpleXMLElement::current()</strong></span> 
    はサブクラスの <span class="classname"><a href="class.simplexmliterator.php" class="classname">SimpleXMLIterator</a></span>
    でのみ宣言されていました。
   </p>
  </div>

  <p class="para">
   このメソッドは、現在の要素の
   <span class="classname"><a href="class.simplexmlelement.php" class="classname">SimpleXMLElement</a></span> を返します。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-simplexmlelement.current-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">この関数にはパラメータはありません。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-simplexmlelement.current-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   このメソッドは、現在の要素の
   <span class="classname"><a href="class.simplexmlelement.php" class="classname">SimpleXMLElement</a></span> を返します。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-simplexmlelement.current-errors">
  <h3 class="title">エラー / 例外</h3>
  <p class="para">
   失敗した場合は <span class="classname"><a href="class.error.php" class="classname">Error</a></span> をスローします。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-simplexmlelement.current-changelog">
  <h3 class="title">変更履歴</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>バージョン</th>
      <th>説明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.1.0</td>
      <td>
       <span class="methodname"><strong>SimpleXMLElement::current()</strong></span>
       に不正なイテレータを渡してコールすると、
       <span class="classname"><a href="class.error.php" class="classname">Error</a></span> をスローするようになりました。
       これより前のバージョンでは、<strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> を返していました。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-simplexmlelement.current-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>例1 現在の要素を返す</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$xmlElement </span><span style="color: #007700">= new </span><span style="color: #0000BB">SimpleXMLElement</span><span style="color: #007700">(</span><span style="color: #DD0000">'&lt;books&gt;&lt;book&gt;PHP basics&lt;/book&gt;&lt;book&gt;XML basics&lt;/book&gt;&lt;/books&gt;'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$xmlElement</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">rewind</span><span style="color: #007700">(); </span><span style="color: #FF8000">// 最初の要素に巻き戻します。こうしないと current() は動作しません。<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$xmlElement</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">current</span><span style="color: #007700">());<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="annotation-interactive examplescode"><pre class="examplescode">object(SimpleXMLElement)#2 (1) {
  [0]=&gt;
  string(10) &quot;PHP basics&quot;
}</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-simplexmlelement.current-seealso">
  <h3 class="title">参考</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="simplexmlelement.key.php" class="methodname" rel="rdfs-seeAlso">SimpleXMLElement::key()</a> - 現在のキーを返す</span></li>
    <li><span class="methodname"><a href="simplexmlelement.next.php" class="methodname" rel="rdfs-seeAlso">SimpleXMLElement::next()</a> - 次の要素に移動する</span></li>
    <li><span class="methodname"><a href="simplexmlelement.rewind.php" class="methodname" rel="rdfs-seeAlso">SimpleXMLElement::rewind()</a> - 最初の要素に巻き戻す</span></li>
    <li><span class="methodname"><a href="simplexmlelement.valid.php" class="methodname" rel="rdfs-seeAlso">SimpleXMLElement::valid()</a> - 現在の要素が有効かどうかを調べる</span></li>
    <li><span class="classname"><a href="class.simplexmlelement.php" class="classname">SimpleXMLElement</a></span></li>
   </ul>
  </p>
 </div>


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