Roshan Rathod
What are PHP sessions and how do they work?
By Roshan Rathod in PHP on Aug 03 2020
  • Cristopher Coronado
    Aug, 2020 6

    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>

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS