I have a flat file called data.txt. Each line contains four entries.
data.txt
blue||green||purple||primary
green||yellow||blue||secondary
orange||red||yellow||secondary
purple||blue||red||secondary
yellow||red||blue||primary
red||orange||purple||primary
And I tried this to find out if the variable "yellow" exists as the FIRST entry on any of the lines:
$color = 'yellow';
$a = array('data.txt');
if (array_key_exists($color,$a)){
// If true
echo "$color Key exists!";
} else {
// If NOT true
echo "$color Key does not exist!";
}
but it is not working as expected. What can I change to get this going? Thanks....