title: Unable to get the static nature
body: <p>I am trying to make the <code>$x</code> output the static nature as I have tried in the code below, I wasn't able to do that simple so i tried using the global array (as i can't access the variable that i declared outside the function), So i tried using the global array which didn't work either, next I tried to achieve the same by using the <code>global keyword</code> , but latter didn't work either can someone suggest me what i am doing wrong?</p>
  
  <pre><code>&lt;?php
  global$x=5;
  global$y=10;
  global static $s=0;
  $s=$x + $y;
  //echo $s;
  function willthiswork(){
  //GLOBAL['s']=GLOBAL['x']+GLOBAL['y'];
  $s=$x+$y;
  $s++
  }
  willthiswork();
  willthiswork();
  willthiswork(); 
  ?&gt;
  </code></pre>
  
  <p>I am really new with php and using this link to learn if there's any better resource please do mention it.
  <a href="https://www.w3schools.com/php/php_variables.asp" rel="nofollow noreferrer">https://www.w3schools.com/php/php_variables.asp</a></p>