I have the folowing multidimensional array from which i want to delete the last two elements from the sub array(there may be any number of subarray).
$data= Array
(
[0] => Array
(
[rowdata] => Array
(
[0] => Array
(
[DOELGROEP] => 2
[KANTOOR] => 2
[OBLIGOCATEGORIE] => 3
[] => Overall NPS
[0] => Array
(
[1] => npsorg
[3] => npsdetbe
)
)
[1] => Array
(
[DOELGROEP] => 2
[KANTOOR] => 2
[OBLIGOCATEGORIE] => 3
[] => Overall NPS
[0] => Array
(
[1] => npsorg
[3] => npsdetbe
)
)
)
[reason] => column values are not correct
)
)
Desired Output:
$data= Array
(
[0] => Array
(
[rowdata] => Array
(
[0] => Array
(
[DOELGROEP] => 2
[KANTOOR] => 2
[OBLIGOCATEGORIE] => 3
)
[1] => Array
(
[DOELGROEP] => 2
[KANTOOR] => 2
[OBLIGOCATEGORIE] => 3
)
)
[reason] => column values are not correct
)
)
what i have tried:
unset ($data[count($data)-2]);
the above code is not working i.e. its not removing the last two elements.what am i doing wrong?
Thanks in advance
unsetto that version?