title: Dynamically finding a particular array index
body: <p>I have a large multi-dimensional array with multiple occurrences of <code>#options</code> indexes. The following is a single array example:</p>
  
  <pre><code>FORM =&gt; Array
  (
      [#attached] =&gt; Array
          (
              [library] =&gt; quiz/quiz-form-styling
          )
  
      [text_0] =&gt; Array
          (
              [#type] =&gt; markup
              [#markup] =&gt; 
  Wherelese did Walter White work besides being a teacher?
  
  
          )
  
      [radio_1] =&gt; Array
          (
              [#type] =&gt; radios
              [#options] =&gt; Array
                  (
                      [0] =&gt;  An elder Care home
                      [1] =&gt; [A car wash]
                      [2] =&gt;  A beauty saloon
                      [3] =&gt;  For Skylers old boss
                  )
  
              [#correct] =&gt; testing_correct_for radio
          )
  
      [text_2] =&gt; Array
          (
              [#type] =&gt; markup
              [#markup] =&gt; 
          )
  )
  </code></pre>
  
  <p>In the example above, the parent array of <strong>#options</strong> is <em>radio_1</em>. But that is not always the case as the arrays are dynamically generated. There is no way to know in advance what the parent index would be but there is always an <em>#options</em> index.</p>
  
  <p>What I'm trying to figure out is how to find and retrieve the data in all occurrences of <strong>#options</strong>. How can I do that?</p>