Remove specific value from array using php?

/ By Arjun / Published on March 29, 2016

This post shows the possible ways to remove specific element from array based on value of the element.

Removing specific value Using array_diff()

Using this method we can remove one or more elements where using other methods we can only remove/delete one element at a given instance.

Removing specific value using array_search()

Using this method we can only remove one element at given instance. If there are two values with the same text it will remove first element only.

Removing specific value using array_keys()

If there can be multiple items with the same value, you can use array_keys to get the keys to all items as shown below.

That is it.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

4 3 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x