I want to get data from an array in array inside of session. i want to get the rule1 of each array. But when i print $y like in the code below, it doesn't print anything
$this->session->userdata['namearray'];
this is print_r of the session
Array (
[0] => stdClass Object
(
[class] =>array (
[0] => stdClass Object
(
[rule1] =>a
)
[1] => stdClass Object
(
[rule1] =>b
)
)
[1] => stdClass Object
(
[class] =>array (
[0] => stdClass Object
(
[rule1] =>c
)
[1] => stdClass Object
(
[rule1] =>d
)
)
)
foreach ($nameArray as $y){
$string2[] = $y->class->rule1;
}
how to make the correct foreach