Instead of doing the following:
print $this->session->userdata('username');
print $this->session->userdata('email');
print $this->session->userdata('phone');
print $this->session->userdata('fax');
//etc...
Is there a way to do something like
foreach($this->session as $key=>$val) print $key.'-'.$val;
Or is it possible to do something like
print_r($this->session);
The reason I’m asking is because I don’t know what the SESSION keys are and I also want to be able to loop through CI Session values.
$this->sessionis an object of course,and you can dump it usingprint_rorvar_dumpbut i recommend using this for fetching all of your session data except for flash data:
$sessionArray = $this->session->all_userdata();