This transforms all the session values into a string representation. Similar to serialize() but uses a different format.

session_start();
$_SESSION['a'] = 'apple';
$_SESSION['b'] = false;
$_SESSION['c'] = 'monkey';
 
$str = session_encode(); // a|s:5:"apple";b|b:0;c|s:6:"monkey";