I store nested, mluti-dimensional arrays in session:
Inside of a model:
public function doSomething() {
$array = [
"value1" => "Awesome",
"value2" => "Heay, neat",
"nested1" => [
"nestedvalue1" => "Super!",
"nestedvalue2" => "Excellent"
]
];
$this->getDi()->getShared('session')->set('sessionval', $array);
return true;
}
Inside of a controller, you can set by:
$this->session->set('sessionval',$array);
Retrieve by calling:
$this->session->get('sessionval'); //in a controller
$this->getDi()->getShared('session')->get('sessionval'); //in a model