title: Trying to create a global value, it gave me an error in php wordpress?
body: <p>Trying to make <code>$emo_word</code> a global variable so I can call it in another function. But whenever I put <code>global $emo_word</code>, it gives me the error below. If I remove <code>global</code>, it is OK, but I want to call the global, what can I do?</p>
  
  <blockquote>
    <p>Warning: Illegal string offset 'cat_id' in /home2/898992on708/public_html/mysitel.com/wp-content/plugins/gallery/gallery.php on line 212</p>
  </blockquote>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  function name_1(){
    global $emo_word;
    $emo_word = array(
          1 =&gt; array(
        'word' =&gt; 'LOL !',
       'id_name' =&gt; 'lol',
       'cat_id' =&gt; '1'
       ),
          2 =&gt; array(
        'word' =&gt; 'COOL !',
       'id_name' =&gt; 'cool',
       'cat_id' =&gt; '2'
       )
            );
    foreach($emo_word as $word){
       $word['cat_id'];
    }
  }
  
  ?&gt;</code></pre>
  </div>
  </div>
  </p>