php variable question?

Kazuma

New member
I want a variable that consist of the same value to all clients. Is there a way to do this without a txt file?

The page will split traffic up into 1/4'ths... So like the variable will initially be 0 but after each user comes it would be incremented by one. If two users come it would be 2, if four users come it would be 0, etc

How do you do this in php?
By global I mean the value isn't set everytime the user loads the php script.... The variable is shared between all running php scripts. Any script should be able to update the value.

For example

<?php
$myVar = 0; //Pretend all scripts can see this
?>

Another file:
<?php
$m = $myVar; //How would I retrieve myVar?

if ($myVar == 4) { $myVar = 0 }
?>
Also, say that second script is loaded by some other ip address... that user should obtain a $myVar as well except incremented by one since the previous execution updated it.
Just saw I forgot to add ++ lol...

I meant to say
<?php
$m = $myVar++;
?>
 
Back
Top