25) { throw new Exception('Variable res not set'); } } catch (Exception $e) { // If an exception occur, let's just set the default value $res = $default; } // And finally, generate a correct js code with no possible injection echo "params.get.res = " . $res . ";\n";