1

I have an array like:

$array=[1,4,15,8,3,7,15];

I get values from DB, so I want to remove "8" value from this array but arrays has undefined index. How can I do this ?

julie
  • 111
  • 1
  • 2
  • 13
Furkan Kalkan
  • 33
  • 1
  • 1
  • 3
  • 2
    With [`array_search`](http://php.net/array_search) and [`unset`](http://php.net/unset) . – mario Jun 22 '13 at 16:32
  • [This](http://php.net/manual/en/ref.array.php) might be what you're looking for... – BudwiseЯ Jun 22 '13 at 16:32
  • 1
    Do you want to remove all "8" if there is many or just one of them? – Sergio Jun 22 '13 at 16:33
  • Thanks dudes, i must be learn too... – Furkan Kalkan Jun 22 '13 at 16:35
  • 1
    As @Sergio asked and inferred, be careful you look at all the answers provided on the duplicate answer link. If it is possible that "8" occurs more than once (like "15" in your example) then you'll want to consider something other than the accepted answer. – dajoto Jun 06 '16 at 15:34

0 Answers0