It is way to store information (in variables). In order they are available in multiple pages for the same web application.

Example:

  1. <?php
  2. // Start the session
  3. session_start();
  4. ?>
  5. <!DOCTYPE html>
  6. <html>
  7. <body>
  8. <?php
  9. // Set session variables
  10. $_SESSION["favcolor"] = "green";
  11. $_SESSION["favanimal"] = "cat";
  12. echo "Session variables are set.";
  13. ?>
  14. </body>
  15. </html>