Can anyone explain how variables work in PHP?
When I wrote the script to a game (San Andreas Multiplayer, Pawn language), i used variables like this:
new Health = 100;
but it was incorrect, because it was the same variable for all players. So, the correct way was:
new Health[NUMBER_OF_PLAYERS];
Health[player_ID] = 100;
And now, my question is: How do it works in PHP?
When I create a variable
$x = 100;
and two buttons in JS:
- buttonA - that increase value by 1
- buttonB - display current value of variable $x
What will happen, when one user click buttonA few times? The other users will see (by clicking buttonB) value higer than 100, because there is only one variable $x on the server? Or they will see 100, because each user has "own variable"?
Is there a difference, when it's working by AJAX, or directly inserting PHP code into .html file (using <?php
tag)?