Reply to Re: [PHP] deleting $_SESSION

Your name:

Reply:


Posted by Jochem Maas on 04/11/05 20:45

AndreaD wrote:
> I have a session variable called
>
> $_SESSION['total'] the problem is I can't delete/reset it. I have tried
>
> $_SESSION['total']= 0;
>
> $_SESSION['total']= "";

I guess you didn't know/think of trying null:

$_SESSION['total'] = null;

....which has the same effect as using:

unset($_SESSION['total']); // as you have been told on at least 3 diff occasions ;-)

this oneliner might give you a little insight:
<?php $x=1;$y=2;unset($x);$y=null;var_dump($x,isset($x),empty($x),$y,isset($y),empty($y)); ?>

I encourage you to read the following pages for a better understanding of variables:
http://php.net/unset http://php.net/empty http://php.net/isset,
and this section: http://php.net/variables

have fun!
rgds,
Jochem

PS - personally I try to remember to set a var to null if the code is inside a loop,
in order to minimize function call overhead. (anyone with real skill care to comment
as to whether there is actually a difference between setting a var to null and calling unset
on it? also speedwise?)

>
>
> and the thing remains. Is there a special way to delete them??
>
>
> AD
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация