Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

221
Views
Remove one index from the array in codeigniter controller
Array ( 
    [issuer_id] => in.gsvm 
    [org_id] => 00738648 
    [doc_type] => ABCDS 
    [RROLL] => 12589 
    [YEAR] => 2020 
)

I want to remove org_id from array and store that data in another variable

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

You can use unset().

php > $array = Array (0 => 123, 1 => 456);
php > unset($array[0]);
php > print_r($array);
Array
(
    [1] => 456
)

It destroys the variable, which in this case is the array item matching the index that you want to delete.

You assign the value to a new variable before removing it.

php > $array = Array (0 => 123, 1 => 456);
php > $v = $array[0];
php > unset($array[0]);
php > print_r($array);
Array
(
    [1] => 456
)
php > echo $v;
123

over 4 years ago · Santiago Trujillo Report

0

Store the value in a variable:

$orgId = $array['org_id'];

and remove it from the array:

unset($array['org_id']);

This is just ordinary PHP which works the same in CodeIgniter.

over 4 years ago · Santiago Trujillo Report

0

You can use unset(array) method of PHP programming language to remove an item. for example

$dataArray = ['key1'=>'data1','key2'=>'data2'];

unset($dataArray['key1']);

Then pass the array to insert function.

$this->db->insert('table_name',$dataArray);

You can find details example on this link: https://www.techiedelight.com/remove-elements-array-php/

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!