How long do PHP static variables persist?

Viewed 11237

How long do PHP static variables persist, i.e. how long does a "PHP run" persist? With say a command line program there is a defined start and end, but in web w/ AJAX I don't know how to define this.

Here are 3 ways I've seen a PHP script started.

  1. User (Requesing a PHP page)
  2. Javacript calling PHP (AJAX)
  3. PHP calling more PHP via a header()

In my actual application I have javascript call a php script via AJAX that script uses the header() to reload the site. This would be consideredt two different runs. Each has their own static variables that do not relate.

7 Answers
Related