Skip to content
Home » Web » PHP » Real Number of PHP Session Constants

Real Number of PHP Session Constants

What are the real integers of constants PHP_SESSION_DISABLED, PHP_SESSION_NONE and PHP_SESSION_ACTIVE? A simple test can tell us the truth.

<?php
echo PHP_SESSION_DISABLED . ": PHP_SESSION_DISABLED";
echo " - if sessions are disabled" . "<br />";
echo PHP_SESSION_NONE . ": PHP_SESSION_NONE";
echo " - if sessions are enabled, but none exists." . "<br />";
echo PHP_SESSION_ACTIVE . ": PHP_SESSION_ACTIVE";
echo " - if sessions are enabled, and one exists." . "<br />";
?>

The result is as follow:

0: PHP_SESSION_DISABLED - if sessions are disabled
1: PHP_SESSION_NONE - if sessions are enabled, but none exists.
2: PHP_SESSION_ACTIVE - if sessions are enabled, and one exists.

Now we know the real number of PHP session constants.

Leave a Reply

Your email address will not be published. Required fields are marked *