PHP compare values with HTML special characters

Viewed 35

I am trying to compare rows from 2 PHP arrays like this...

if ($row1[$i] == $row2[$i]) {
    echo 'Rows match';
} else {
    echo 'Rows do not match';
}

This is working correctly until it comes across something that is encoded, so apostrophe is a good example. So the below 2 are not equal...

This is an apostrophe'
This is an apostrophe'

I have tried using htmlspecialchars_decode to attempt to convert them before comparing but this is not working. How can I compare these 2 rows?

1 Answers
Related