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 ?

5
  • 2
    With array_search and unset . Commented Jun 22, 2013 at 16:32
  • This might be what you're looking for... Commented Jun 22, 2013 at 16:32
  • 1
    Do you want to remove all "8" if there is many or just one of them? Commented Jun 22, 2013 at 16:33
  • Thanks dudes, i must be learn too... Commented Jun 22, 2013 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. Commented Jun 6, 2016 at 15:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.