Welcome Guest, Not a member yet? Register   Sign In
Differences in session variable declaration
#11

(This post was last modified: 09-13-2018, 03:20 PM by php_rocs.)

@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

(This post was last modified: 09-13-2018, 09:31 PM by n2fole00.)

(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




Theme © iAndrew 2016 - Forum software by © MyBB