<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.reflectionreference.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'reflectionreference.fromarrayelement.php',
    1 => 'ReflectionReference::fromArrayElement',
    2 => '从数组元素创建一个 ReflectionReference',
  ),
  'up' => 
  array (
    0 => 'class.reflectionreference.php',
    1 => 'ReflectionReference',
  ),
  'prev' => 
  array (
    0 => 'reflectionreference.construct.php',
    1 => 'ReflectionReference::__construct',
  ),
  'next' => 
  array (
    0 => 'reflectionreference.getid.php',
    1 => 'ReflectionReference::getId',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/reflection/reflectionreference/fromarrayelement.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="reflectionreference.fromarrayelement" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ReflectionReference::fromArrayElement</h1>
  <p class="verinfo">(PHP 7 &gt;= 7.4.0, PHP 8)</p><p class="refpurpose"><span class="refname">ReflectionReference::fromArrayElement</span> &mdash; <span class="dc-title">从数组元素创建一个 ReflectionReference</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-reflectionreference.fromarrayelement-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>ReflectionReference::fromArrayElement</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$array</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$key</code></span>): <span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="class.reflectionreference.php" class="type ReflectionReference">ReflectionReference</a></span></span></div>

  <p class="para rdfs-comment">
   从数组元素创建一个 <span class="classname"><a href="class.reflectionreference.php" class="classname">ReflectionReference</a></span>。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-reflectionreference.fromarrayelement-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">array</code></dt>
    <dd>
     <p class="para">
      包含潜在引用的 <span class="type"><a href="language.types.array.php" class="type array">array</a></span>。
     </p>
    </dd>
   
   
    <dt><code class="parameter">key</code></dt>
    <dd>
     <p class="para">
      一个 <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> 或者 <span class="type"><a href="language.types.string.php" class="type string">string</a></span> 类型的 key。
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-reflectionreference.fromarrayelement-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   如果 <code class="literal">$array[$key]</code> 是引用，返回 <span class="classname"><a href="class.reflectionreference.php" class="classname">ReflectionReference</a></span>
   实例，否则返回 <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-reflectionreference.fromarrayelement-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   如果 <code class="parameter">array</code> 不是一个 <span class="type"><a href="language.types.array.php" class="type array">array</a></span>，或者 <code class="parameter">key</code>
   不是 <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> 或者 <span class="type"><a href="language.types.string.php" class="type string">string</a></span> 类型，会抛出 <span class="classname"><a href="class.typeerror.php" class="classname">TypeError</a></span>。
   如果 <code class="literal">$array[$key]</code> 不存在，
   会抛出 <span class="classname"><a href="class.reflectionexception.php" class="classname">ReflectionException</a></span>。
  </p>
 </div>


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