That's not quite right, I think you missed out a small (but potentially important) point raised in the PHP manual. strpos() will return 0 if the search string is at position 0, and this will be interpreted as false, unless you do something like:
if (strpos($_SERVER['REQUEST_URI'], "?") !== false) {
echo 'y';
} else {
echo 'n';
}