scuarplex Posted September 29, 2011 Share Posted September 29, 2011 Hey, i was reading some code and i find this: if(stristr($_SESSION["s"]["user"]["asdasd"]),$someString) How the double/triple [] in $_SESSION works ? PS: I tryied to google it but it was kinda hard to search :X Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/248082-_session/ Share on other sites More sharing options...
the182guy Posted September 29, 2011 Share Posted September 29, 2011 It's the same for any array variable. Use print_r() to print out the array, this will allow you to visualise the structure of it and understand how it works. It's basically arrays within arrays aka a multidimensional array. Quote Link to comment https://forums.phpfreaks.com/topic/248082-_session/#findComment-1273849 Share on other sites More sharing options...
xyph Posted September 29, 2011 Share Posted September 29, 2011 <?php $a1['level1']['level2'] = 'test'; // is the same as $a1 = array( 'level1'=>array('level2'=>'test') ); $a2[0][0] = 'test'; // is the same as $a2 = array( array('test') ); ?> Use var_dump or print_r to output/debug the array structure/values; Quote Link to comment https://forums.phpfreaks.com/topic/248082-_session/#findComment-1273907 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.