Reputation: 894
I have an issue with the below array, where the 1st one (should be Alpe d'Huez) is not escaping/being found.
Am I escaping the apostrophe wrong?
<?php
$images = array (
'Alpe D\'Huez' => 'images/flags/small/france_sm.jpg',
'Le Corbier' => 'images/flags/small/france_sm.jpg',
'Les Deux Alpes' => 'images/flags/small/france_sm.jpg'
);
if (isset($images[$this->item->title])) {
?>
<?php } ?>
Upvotes: 2
Views: 1587
Reputation: 7611
As bardiir says, it's escaped just fine. I note that your question says "Alpe d'Huez" (lower case d), but your array says "Alpe D'Huez" (upper case d). It's case sensitive - could that be the issue?
Upvotes: 0
Reputation: 14792
That's perfectly escaped like that.
Maybe the problem is with the value that you are comparing against. Try 'Alpe D\\'Huez' to see if in your value the apostrophe is double-escaped or try other apostrophe types like ` or ´
Upvotes: 1