PHP session_cache_expire() Function

What is session_cache_expire Function?


The "session_cache_expire()" function returns current cache expire.



In the above syntax the user can set the session cache expire time, usually a default value of 180 seconds is set in the session.cache_limiter, so session cache expire should be called before the session start() function.

Example :

$cache_limiter = session_cache_limiter();
$cache_expire = session_cache_expire();
echo "The cache limiter is now set to $cache_limiter<br />";
echo "The cached session pages expire after $cache_expire minutes";
Result :

The cache limiter is now set to private
The cached session pages expire after 30 minutes

In the above example, the first session cache limiter is set to "private", so that the session cache expire can be set to 30 minutes, only after that the session_start function is called.

PHP Topics

Ask Questions

Ask Question