Reputation: 312
these my function //store array data to session
function justSession($code)
{
$data = $this->session->userdata('code');
$data[] = $code;
$this->session->set_userdata('code',$data);
}
then these function to print_r session
function printSession()
{
print_r($this->session->userdata('code'));
}
and then output from printSession() is Array([0]=>KG001[1]=>KG002[2]=>KG003)
now, how to remove session 'code' with specified value? i'll to remove the KG001 in session?
Upvotes: 0
Views: 976
Reputation: 1740
if($this->session->userdata($code) == 'KG001')
{
$this->session->unset_userdata($code);
}
Am I understanding your question right?
Upvotes: 1