Reputation: 44051
I have the following snippet of code
if ($summary == "CFD funding Interest Paid" ||
$summary == "Commissions" ||
$summary == "Closing trades") {
print $summary.",".$date.",".$reference.",".$description.",".$amount."<br>";
}
else {
print $summary."*<br>";
}
It outputs the following
Commissions* Commissions* Closing trades* Commissions* Closing trades*
How come the strings do not appear to be matching?
Upvotes: 3
Views: 3552
Reputation: 41050
Add trim()
before the if ()
, it removes unvisible chars like whitespace...
$summary = trim($summary);
if ($summary == "CF...
Upvotes: 6
Reputation: 2655
Perhaps you have leading whitespace? You could trim() that away to see if it helps?
Upvotes: 9