PHP 8.6.0 Beta 1 is available for testing

session_reset

(PHP 5 >= 5.6.0, PHP 7, PHP 8)

session_resetRestablece el array de sesión con los valores originales

Descripción

function session_reset(): bool

session_reset() restablece una sesión con los valores originales almacenados en el almacenamiento de sesión. Esta función requiere una sesión activa y anula los cambios en $_SESSION.

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

Esta función retorna true en caso de éxito o false si ocurre un error.

Historial de cambios

Versión Descripción
7.2.0 El tipo de retorno de esta función es ahora bool . Anteriormente, era void.

Véase también

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes 1 note

up
32
parsa dot mhn at outlook dot com
10 years ago
First of all you should execute this code :
<?php
 session_start();
 $_SESSION["A"] = "Some Value";
?>

then you should execute this one : 
<?php
 start_session();
 $_SESSION["A"] = "Some New Value"; // set new value
 session_reset(); // old session value restored
 echo $_SESSION["A"];
 //Output: Some Value
?>

That is because session_reset() is rolling back changes to the last saved session data, which is their values right after the session_start().
+add a note

AltStyle によって変換されたページ (->オリジナル) /