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.

Published by Arjun

I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.

Leave a comment

Your email address will not be published. Required fields are marked *