title: PHP: Get n-th item of an associative array
body: <p>If you have an associative array:</p>
  
  <pre><code>Array
  (
      [uid] =&gt; Marvelous
      [status] =&gt; 1
      [set_later] =&gt; Array
          (
              [0] =&gt; 1
              [1] =&gt; 0
          )
  
      [op] =&gt; Submit
      [submit] =&gt; Submit
  )
  </code></pre>
  
  <p>And you want to access the 2nd item, how would you do it? <code>$arr[1]</code> doesn't seem to be working:</p>
  
  <pre><code>foreach ($form_state['values']['set_later'] as $fieldKey =&gt; $setLater) {
      if (! $setLater) {
          $valueForAll = $form_state['values'][$fieldKey];
          $_SESSION[SET_NOW_KEY][array_search($valueForAll, $form_state['values'])] = $valueForAll; // this isn't getting the value properly
      }
  }
  </code></pre>
  
  <p>This code is supposed to produce:</p>
  
  <pre><code>$_SESSION[SET_NOW_KEY]['status'] = 1
  </code></pre>
  
  <p>But it just produces a blank entry.</p>