PHP session_encode() Function

What is session_encode Function?

Explanation

The "session_encode()" function encodes the current session data as a string.

Syntax:


session_encode(void)

In the above syntax session_encode returns a string with encoded data of the current session.

Example :


<?php
session_start();
if (!$counter) {
$counter=10;
session_register("counter");
}
echo $counter;
echo"<br>";
echo session_encode();
?>
Result :

10
counter|i:10;

In the above example, first the counter value is displayed then the ecoded data is displayed, note session_start() is to be called at first.

PHP Topics


Ask Questions

Ask Question