How can the in_array() function be correctly implemented in PHP?

When using the in_array() function in PHP, make sure to pass the value to search for as the first argument, followed by the array to search in as the second argument. This function returns true if the value is found in the array, and false otherwise. It is important to note that in_array() performs a loose comparison, so strict comparison may be needed in some cases.

$value = 'apple';
$array = ['apple', 'banana', 'orange'];

if (in_array($value, $array)) {
    echo "Value found in the array.";
} else {
    echo "Value not found in the array.";
}