Last Modified: 05.05.2022
You can handle the variable
$_SESSION directly, however such approach is not advised. All data changes in the global variable will be saved, but we strongly recommend to use the new Bitrix24 API instead of this variable.
Instead of directly using the variable, it's better to use the object, returned by the method
$session = \Bitrix\Main\Application::getInstance()->getSession();
echo $session['foo']; //bar
This object is implemented by the interface
\ArrayAccess, as well as by \Bitrix\Main\Session\SessionInterface.