PHP 8.5.0 Alpha 4 available for testing

Voting

: min(seven, seven)?
(Example: nine)

The Note You're Voting On

mhd dot nickz13 at gmail dot com
6 years ago
session_abort()  closes the current session and discards the changes applied to Session array in the current page  , it doesn't delete the session file 
let me explain with one example.
page 1.php :
<?php
session_start
();
$_SESSION['city']="Sydney";
echo
"<a href=\"2.php\"> page2</a>";
?>
when you open this page , a session file is created on the server (to find out where session files are saved run "echo session_save_path()" )  with the name of session_id  and the content of  the variable :

  sess_o22iabs75j93uhc7i4jf1lecjk  (file name)
city|s:6:"Sydney";               (content)

if we go to 2.php containing this code :

<?php
session_start
();
$_SESSION['country']="Australia";
echo
session_encode();
session_abort();
session_start();
echo
"<br>".session_encode();
?>

when session_abort is executed , the session is closed and the change which here is the 'country' element of Session array is discarded . 

Output : 
city|s:6:"Sydney";country|s:9:"Australia";
city|s:6:"Sydney";

<< Back to user notes page

To Top