boo_lolly Posted December 6, 2007 Share Posted December 6, 2007 so, i need to remove all data from my sessions but for some reason it's not working out. i've tried session_destroy() but for some reason that didn't work so i wrote a script. but the script doesn't work. error Fatal error: Cannot redeclare flush() in /var/www/piratebeachhouse/index.php on line 294 script <?php function flush($array) { foreach ($array as $key => $val) { if (is_array($val)) { flush($val); } else { $val = null; } } } //<-- line 294 ?> so what's the deal? i've written plenty of functions before that were repetitive. (i forgot the worf used when you call upon a function within the same function) what's wrong with my script? and what alternatives should i try? Link to comment https://forums.phpfreaks.com/topic/80393-solved-problem-with-flushing-sessions-script/ Share on other sites More sharing options...
trq Posted December 6, 2007 Share Posted December 6, 2007 There is a built in function in php called flush. I'm not sure why you don't simply use... <?php $_SESSION = array(); ?> anyway. Link to comment https://forums.phpfreaks.com/topic/80393-solved-problem-with-flushing-sessions-script/#findComment-407619 Share on other sites More sharing options...
Stooney Posted December 6, 2007 Share Posted December 6, 2007 $_SESSION = array(); session_destroy(); setcookie ('PHPSESSED', '', time()- 300, '/', '', 0); Link to comment https://forums.phpfreaks.com/topic/80393-solved-problem-with-flushing-sessions-script/#findComment-407633 Share on other sites More sharing options...
boo_lolly Posted December 6, 2007 Author Share Posted December 6, 2007 thorpe, thanks for the advice. it's been a while since i've programmed in php and i find myself doing things the hard way. you da man. as usual. Link to comment https://forums.phpfreaks.com/topic/80393-solved-problem-with-flushing-sessions-script/#findComment-407636 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.