if ($js_enabled == "Y") {
$qry_string = preg_replace("/(&*)js=y/", "", $QUERY_STRING);
$js_update_link = $PHP_SELF."?".($qry_string?"$qry_string&":"")."js=n";
}
else {
$qry_string = preg_replace("/(&*)js=n/", "", $QUERY_STRING);
$js_update_link = $PHP_SELF."?".($qry_string?"$qry_string&":"")."js=y";
}
preg
is faster and uses a PERL-style syntax (as opposed to the old Postfix style), so you may need some slight adjustments in the expression.