Skip to main content

Posts

Showing posts with the label value

How can I check if an array contains a specific value in php?

I have an array of data created by a form that and I would like find out if it contains a specific value and let the user know that it is there. This is my array: Array ( [0] => kitchen [1] => bedroom [2] => living_room [3] => dining_room) and I would like do something like: if(Array contains 'kitchen') {echo 'this array contains kitchen';} What is the best way to do the above???