title: Get variables from the outside, inside a function in PHP
body: <p>I'm trying to figure out how I can use a variable that has been set outside a function, inside a function. Is there any way of doing this? I've tried to set the variable to "global" but it doesn't seems to work out as expected.</p>
  
  <p>A simple example of my code</p>
  
  <pre><code>$var = '1';
  
  function() {
      $var + 1;
      return $var;
  }
  </code></pre>
  
  <p>I want this to return the value of 2.</p>