|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-08-18 12:03 UTC] joustin at plusnet dot pl
Check this out!
I thought array_walk would be a good workaround for the session_unregister limitation of 'one variable unregistering at a time'.
<? session_start();
$one = 1;
$two = 2;
session_register('one','two');
$foo = array('one','two');
@array_walk($foo,'session_unregister');
if(session_is_registered('one') || session_is_registered('two')){
echo 'why?';
}
?>
Well.. there is even a workaround for this workaround, but when you look at it, it makes you smile ironically :)
<? function damn_unregister($what){
session_unregister($what);
}
@array_walk($foo,'damn_unregister');
if(!session_is_registered('one') && !session_is_registered('two')){
echo 'now ok';
}
?>
What am I missing here ?
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 15:00:01 2025 UTC |
If you want to stick to a one-liner, you can use array_walk($foo,create_function('$e','session_unregister($i);')); - Markus