Hi,
I have the following array: Array ( [0] => Array ( [1] => Array ( [0] => 1 [1] => 4 ) ) )
What I am trying to do is delete a specific value from this array e.g. sya I need to delete the value 4 from the third nested array, how could I do this without effecting the rest of the arrays?
Thanks.
Deleting values from an array
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
- EverLearning
- Forum Contributor
- Posts: 282
- Joined: Sat Feb 23, 2008 3:49 am
- Location: Niš, Serbia
Re: Deleting values from an array
You unset by providing the path to the array element that contains value 4(you access array values by keys)
Code: Select all
unset($array[0][1][1]);