So I’m trying to find several special characters, such as {, $ in a string returned by DOM element
When I run
if(strpos("$", $u) === FALSE AND strpos("{", $u) === FALSE AND $u != "#") {
echo "Attempting {$u} ecoded: ".urlencode($u)."<br/>";
return true;
}
However when I run it, it prints out:
Attempting register.php ecoded: register.php
Attempting {$url} ecoded: %7B%24url%7D
Attempting $authUrl ecoded: %24authUrl
Attempting services.php ecoded: services.php
So I tried using HEX values and ASCII but still had no luck!
You’ve reversed the arguments for strpos.
int strpos ( string $haystack , mixed $needle [, int $offset = 0 ] )Just swap them around, and it should work as intended.