title: PHP "Warning: Illegal offset type in ..." array issues have me stumped
body: <p>I've been having considerable trouble trying to figure out why my arrays weren't working as expected. I was using code functionally the same as the code below, but it was silently failing on me in my program, so I wrote an isolated test case using the same types of data and syntax and got the errors about illegal offset types.</p>
  
  <pre><code>Warning: Illegal offset type in &lt;file location&gt;\example.php on line 12
  Warning: Illegal offset type in &lt;file location&gt;\example.php on line 16
  </code></pre>
  
  <p>Those refer to the two lines containing the reference to "$questions[$question]" specifically.</p>
  
  <pre><code>&lt;?php
      $questions = array(
        "訓読み:　玉"=&gt;array("たま","だま"),
        "訓読み:　立"=&gt;array("たて","たち","たつ","たてる","だてる","だて"),
      );
  
      $question = $questions["訓読み:　立"];
  
      if (is_array($questions[$question])){
          $res = $questions[$question][0];
      } else {
          $res = $questions[$question];
      }
      echo $res;
  ?&gt;
  </code></pre>
  
  <p>I think I'm just beyond my skill level here, because while I can see the warning on <a href="http://php.net/manual/en/language.types.array.php" rel="noreferrer">http://php.net/manual/en/language.types.array.php</a> that states <em>"Arrays and objects can not be used as keys. Doing so will result in a warning: Illegal offset type."</em>, I cannot see how what I'm doing is any different than Example #7 on that very page.</p>
  
  <p>I would greatly appreciate an explanation that would help me understand and solve my problem here.</p>
  
  <p>Thank you in advance!</p>