Say I have an array:
$before = array(1,2,3,3,4,4,4,5)
How would I remove just one occurence of eg ‘3’ ?
$after = array(1,2,3,4,4,4,5)
(I don’t know where in the array that number will be)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use a variety of methods, depending on what exactly you’re trying to do:
array_search()and thenunset()it.array_splice()to replace it with nothing.array_filter()with a custom callback.