• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Differences in session variable declaration

#11
@n2fole00,

I can't believe I missed this. The issue is your if condition. see... https://stackoverflow.com/questions/1374...s-0-in-php

I would do something like this...
$site_lang = ($_SESSION['site_lang'] === NULL)? FALSE : $_SESSION['site_lang']; or
$site_lang = (isset($_SESSION['site_lang']))? FALSE : $_SESSION['site_lang'];
Reply

#12
(09-13-2018, 03:20 PM)php_rocs Wrote: @n2fole00,

I can't believe I missed this.  The issue is your if condition.  see... https://stackoverflow.com/questions/1374...s-0-in-php

I would do something like this...
$site_lang = ($_SESSION['site_lang'] === NULL)? FALSE : $_SESSION['site_lang']; or
$site_lang = (isset($_SESSION['site_lang']))? FALSE : $_SESSION['site_lang'];

Ok thanks, but why does
PHP Code:
$site_lang $ci->session->site_lang
not trigger the error as
PHP Code:
$site_lang $_SESSION['site_lang'
when tested for boolean truth on line
PHP Code:
if ($site_lang) { 
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.