lastitems.php
session_start();
$_SESSION['var'] = 'something';
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?
Solution
lastitems.php
session_start();
$_SESSION['var'] = 'something';