I believe that you can pass the array to $this->session->set_userdata();
I have not tested this code, so just try something in the following lines:
$data = array( 'whatever' => 'somevalue', 'youget' => 'theidea' ); $this->session->set_userdata($data);
NB: When I say that I have not tested the code. I used this code and I know that it works, I mean that I did not test it if it reduces the number of headers sent.
source share