title: Global variables vs declaring variables globally
body: <p>I am in a situation where I need to store every visitors IP address for some processing. I know sessions can do the job really well, but I don't want this data to be stored in any form of cookie, session anywhere. I need this data to be destroyed, as soon as the page is existed/closed.</p>
  <p>So, my intention is to create a <code>global.php</code> file and just store it in a variable, this file then will be placed at the top of every page. (bad practice, I know)</p>
  <p>Now, there are two ways I can store information in this file. One is using the <code>global $var</code> (which does not make sense, since it is accessible anywhere), another is is just simply initializing a <code>$variable</code> Now, since this <code>global.php</code> file will be added on top of every page, it makes the advantages of using a super global variable trivial.</p>
  <p>Now, if you are asking why I have not just used <code>global $var</code> to begin with is because, I have been hearing how bad they are, and they should be avoided .....</p>
  <p>So, the with this negative talk, the advantage of using <code>global $var</code> has diminished and now I can't see, what is more appropriate to use in this scenario.</p>
  <h1>..in a nutshell.</h1>
  <p>When you declare a variable inside a file, and you share that file in every script, what difference (performance) does it make whether you declare that variable as is or using the <code>global</code> keyword.</p>