Question

I have a static variable defined in some file called lastitems.php.

lastitems.php gets called every 5 seconds by a javascript function update_items().

But because lastitems.php is totally another file, then the static variable is redefined every time the file gets opened.

Is there a way to avoid redefining (re-initiating) the variable?

Was it helpful?

Solution

lastitems.php

session_start();
$_SESSION['var'] = 'something';
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top