I am getting a variable from the url in php using $_GET[]. The url looks like: http://www.site.com/index.php?x=B%FCergschaften which i am comparing to values in an array: $y=array('Bauherrenhaftpflicht','Gebäudeversicherung','Büergschaften');
I understand that the variable in the url is decoded by the $_GET function but when i compare it to the array i am not getting a match.
This is the code i use to compare:
$x = $_GET['x']; foreach($y as $value){ if($value == $x){ echo "Found!"; } }
I have tried urldecode function but it doesn't work.
How do I correctly decode the variable from the url so that the special character is correctly decoded and the variable compared to the array?
Many thanks.