CodeIgniter Forums

Full Version: How to get ids from session in codeIgniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to know is there any way to get all qids without using foreach loop.


PHP Code:
$data=array( 
             
'position' =>$row->pos,
 
            'qid' =>$row->id
        
);
                    
$items=$this->session->userdata('mcqs');                  

$items
[]=$data;

$mcqs=$this->session->set_userdata('mcqs'$items); 

PHP Code:
Array
(
 
  [0] => Array
 
      (
 
          [position] => 5
           
[qid] => 3
       
)
 
  [1] => Array
 
      (
 
          [position] => 6
           
[qid] => 4
       
)

 
  [2] => Array
 
      (
 
          [position] => 2
           
[qid] => 5
       
)

 
  [3] => Array
 
      (
 
          [position] => 4
           
[qid] => 1
       
)



 please help  me .
PHP Code:
$qids array_column($array,'qid'); 
For more information:
http://php.net/manual/en/function.array-column.php
@Wouter60

It is exactly what i am looking for.

Thanks