<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.arrayaccess.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'arrayaccess.offsetget.php',
    1 => 'ArrayAccess::offsetGet',
    2 => 'Offset to retrieve',
  ),
  'up' => 
  array (
    0 => 'class.arrayaccess.php',
    1 => 'ArrayAccess',
  ),
  'prev' => 
  array (
    0 => 'arrayaccess.offsetexists.php',
    1 => 'ArrayAccess::offsetExists',
  ),
  'next' => 
  array (
    0 => 'arrayaccess.offsetset.php',
    1 => 'ArrayAccess::offsetSet',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'language/predefined/arrayaccess/offsetget.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="arrayaccess.offsetget" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ArrayAccess::offsetGet</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ArrayAccess::offsetGet</span> &mdash; <span class="dc-title">Offset to retrieve</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-arrayaccess.offsetget-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ArrayAccess::offsetGet</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$offset</code></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 at specified offset.
  </p>
  <p class="para">
   This method is executed when checking if offset is <span class="function"><a href="function.empty.php" class="function">empty()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-arrayaccess.offsetget-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">offset</code></dt>
     <dd>
      <p class="para">
       The offset to retrieve.
      </p>
     </dd>
    
   </dl>
  </p>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-arrayaccess.offsetget-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Can return all value types.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-arrayaccess.offsetget-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
    <p class="para">
      It&#039;s possible for implementations of this method to return by reference.
      This makes indirect modifications to the overloaded array dimensions of
      <span class="classname"><a href="class.arrayaccess.php" class="classname">ArrayAccess</a></span> objects possible.
    </p>
    <p class="para">
      A direct modification is one that replaces completely the value of
      the array dimension, as in <code class="literal">$obj[6] = 7</code>. An
      indirect modification, on the other hand, only changes part of the
      dimension, or attempts to assign the dimension by reference to
      another variable, as in <code class="literal">$obj[6][7] = 7</code> or
      <code class="literal">$var =&amp; $obj[6]</code>. Increments with
      <code class="literal">++</code> and decrements with <code class="literal">--</code>
      are also implemented in a way that requires indirect modification.
    </p>
    <p class="para">
      While direct modification triggers a call to
      <span class="function"><a href="arrayaccess.offsetset.php" class="function">ArrayAccess::offsetSet()</a></span>, indirect modification
      triggers a call to <span class="function"><strong>ArrayAccess::offsetGet()</strong></span>.
      In that case, the implementation of
      <span class="function"><strong>ArrayAccess::offsetGet()</strong></span> must be able to return by
      reference, otherwise an <strong><code><a href="errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong> message is raised.
    </p>
  </p></blockquote>
 </div>




 <div class="refsect1 seealso" id="refsect1-arrayaccess.offsetget-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="arrayaccess.offsetexists.php" class="methodname" rel="rdfs-seeAlso">ArrayAccess::offsetExists()</a> - Whether an offset exists</span></li>
   </ul>
  </p>
 </div>


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