Home / PHP Tips Generated By ChatGPT / Checking for an Element in an Array in PHP Use in_array() to check if a certain value exists in an array. Source Code $users = ['Alice', 'Bob', 'Charlie']; if (in_array('Bob', $users)) { echo "Bob is in the users array."; }