0

This is my php output:

Array ( [hbon] => 819dc5022135e9cfa06c5a2cd99324f5d94c8d54bb9050215cf8073a53c54c38 [host] => aHhzZGV2Lm15c2hvcGlmeS5jb20vYWRtaW4 
        [ids] => Array ( [0] => 4030248026278 ) 
        [locale] => en-PK 
        [session] => b109efd9b4948eced607e4a5245dbe3dc05e593dab99c58fbc98998c44439aaf     
        [web] => iuhxsdev.com 
        [timestamp] => 1628669451 )

I removed hbon using this code

array_diff_key($params, array('hbon' => ''));

and it removed the hbon and result is

Array ( [host] => aHhzZGV2Lm15c2hvcGlmeS5jb20vYWRtaW4 
        [ids] => Array ( [0] => 4030248026278 ) 
        [locale] => en-PK 
        [session] => b109efd9b4948eced607e4a5245dbe3dc05e593dab99c58fbc98998c44439aaf
        [web] => iuhxsdev.com 
        [timestamp] => 1628669451 )

I also want to remove [ids] but it is in array, how to remove [ids] completely?

Gerard de Visser
  • 7,590
  • 9
  • 50
  • 58
Hannah James
  • 540
  • 3
  • 14

2 Answers2

2

You can remove the ids from the array by using:

unset($array['ids']);

where $array is the variable of the array where subarray ids is stored in.

KIKO Software
  • 15,283
  • 3
  • 18
  • 33
Gerard de Visser
  • 7,590
  • 9
  • 50
  • 58
1

to remove an element in an array use : unset($your_array[key]);

soma
  • 176
  • 9