MrWhddite333
MrWhddite333

Reputation: 1851

How to delete subarray from array in php?

I have multidimensional array and I need to delete one sub array how can I do it without creating another array and copying values?

$myarray 
          [one]   a->1 b->2 c->4
          [two]   a->5  b->8
          [three] a->44 b->55 c->66 

I need to remove two $myarray['two']

Upvotes: 0

Views: 5016

Answers (2)

David van Laatum
David van Laatum

Reputation: 654

unset($myarray['one']) should work

Upvotes: 1

Daniel
Daniel

Reputation: 31579

Try unsetting it, e.g.

unset($myarray['two']);

Upvotes: 6

Related Questions