Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

219
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda