title: How to define variable in PHP to be visible over whole html page?
body: <p>I have an html page with few <code>&lt;?php ?&gt;</code> code snippets in it. In the first snippet I am connecting to a database and fetching data. Now I want to display that data later in some <code>div</code> tags on my HTML page. </p>
  
  <p>So, is the following the easiest way to do it? When I fetch the data from my database, I store them in an array which I define globally - I mean to be visible in other PHP code snippets on page, and then in those div tags I just print whatever elements of that array I want, like this: <code>&lt;div class="info"&gt; &lt;?php print  "{$info[2]} ?&gt; &lt;/div&gt;</code>.  Is this the correct and safe way to do this and how it's done, I mean how should I define this global array <code>$info</code>?</p>