Reputation: 874
I'm trying to remove the ' out of my string.
Here's my code:
$page_title = strtolower(wp_title( '', false, 'right' ));
echo $page_title;
echo "<br/>";
$clean = preg_replace('/[^A-Za-z0-9\-]/', '', $page_title);
echo $clean;
Output:
regio’s
regio8217s
Why does it return 8217 instead of ''?
Thanks in advance
Upvotes: 0
Views: 485
Reputation: 436
Try preg_replace('/[^A-Za-z0-9\-]/u', '', $page_title);
the u after the pattern processes unicode characters too.
Upvotes: 0