Q:

Codeigniter echo session Multidimensional Array variable

Okay im using codeigniter and i got a session where i want to echo [user_id], i can see its an "Multidimensional Array", but i cant seem to get it right...
This is the print_r from all session userdata:
Array ( 
[session_id] => b7e721332248 
[ip_address] => ::1 
[user_agent] => Mozilla/5.0 
[last_activity] => 1409104940 
[user_data] => [name] => 2 [uniq] => 2 
[flexi_auth] => Array ( [user_identifier] => mail.com [user_id] => 2 [admin] => 1 
[group] => Array ( [3] => Master Admin ) 
[privileges] => Array ( ) 
[logged_in_via_password] => 1 
[login_session_token] => 11017021313jhbjh1h2j3b213mab913269d95 ) )

if i type:

print_r($this->session->all_userdata()); // i will get all
echo $this->session->userdata('uniq'); //returns 2
echo $this->session->userdata('user_id'); //returns nothing(THIS IS THE PROBLEM)

Ive tried something like this:
$this->session->userdata(1,1); //1,1 would be array 2 and number 2 which would be user_id
Is it because i can only print out if I loop through them somehow? 

A:

You're trying to call the data directly, if you're want to access user_data or flexi_auth you need to assign the data to a variable then target it since they're arrays. 
$session_data = $this->session->all_userdata();
echo $session_data['user_data']['uniq']; // 2

$user_data = $this->session->userdata('user_data');
echo $user_data['uniq']; /// 2

$flexi_auth = $this->session->userdata('flexi_auth');
echo $flexi_auth['user_id']; /// 2

If you're trying to target a string directly
echo $this->session->userdata('last_activity');

