Remove specific value from array using php?

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.

2 1 vote
Article Rating
Notify of
Inline Feedbacks
View all comments Protection Status
Would love your thoughts, please comment.x