title: Php returns NULL for global variable
body: <p>So I have the following code:</p>
  
  <pre><code>public function pcieh_shortcodes_init() {
      $data = $this-&gt;data;
      var_dump($data); //Return an array which is Expected       
  
      function pcieh_shortcode($atts = [], $content = null) {
           global $data;
           var_dump($data); //Return NULL
       }
  
      add_shortcode('pcieh', 'pcieh_shortcode');
  }
  </code></pre>
  
  <p>When I call <code>pcieh_shortcodes_int</code> I expect the $data inside <code>pcieh_shortcode</code> to have the same value as outside $data since it's global but it returns NULL. Why is that and how can I fix it?</p>