[FX.php List] php 5 problems: I have tried to copy my existing scripts to php5 enabled servers

Bob Patin bob at patin.com
Mon Mar 5 08:48:44 MST 2007


I've always tested to make sure that not only is there a session  
variable by that name, but also that it's not empty, by using

if(strlen($_SESSION['myvar'])>0)

Probably an easier way, but it works fine for me so that's how I've  
been doing it...

I used to use isset, but sometimes I found that a variable was there,  
but there was nothing in it...

Bob Patin
Longterm Solutions
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com

   CONTACT US VIA INSTANT MESSAGING:
      AIM or iChat: longterm1954
      Yahoo: longterm_solutions
      MSN: tech at longtermsolutions.com
      ICQ: 159333060


On Mar 5, 2007, at 9:00 AM, Dale Bengston wrote:

> With PHP 4, I used to do a lot of evaluations like
>
> if ($_SESSION['whatever'])
>
> ...using the presence or absence of a variable to decide action.  
> PHP 5 requires more explicit references, like
>
> if (isset($_SESSION['whatever']))
> if (!empty($_SESSION['whatever']))
>
> ...so I can't be sloppy any more. Maybe you're running into this?
>
> Dale
>
>
> On Mar 5, 2007, at 6:30 AM, Gjermund Gusland Thorsen wrote:
>
>> php 5 problems: I have tried to copy my existing scripts to php5  
>> enabled servers
>>
>> It has problems, especially with ifs while traversing arrays in
>> _REQUEST and _SESSION
>>
>> anyone else encountered this?
>>
>> ggt667
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list