This one is completely beyond me. I'm trying to compare two strings. When I echo them, they appear to be identical, yet when I compare them with the '==' operator, it returns false. For example, when running the code below on my database. It outputs things like "APPARENTLY Apple does not equal Apple". Can anyone shed any light on this?
if ($this->data['list_text']) { //user has entered into textarea
$list = nl2br($this->data['list_text']);
$list_array = explode('<br />',$list);
$ranking = 1;
$company_array = $this->CompanyList->CompanyRanking->Company->find('list',null);
//this is the comparison bit
foreach ($list_array as $key => $value) {
$companyId = null;
foreach ($company_array as $key2 => $value2) {
if ($value2 != $value) {
echo 'APPARENTLY '.$value2.' does not equal '.$value;
} else {
$companyId = $key2;
break;
}
}
$this->data['CompanyRanking'][$ranking]['ranking'] = $ranking;
$this->data['CompanyRanking'][$ranking]['company_id'] = $companyId;
$ranking++;
}
}