Skip to content

Instantly share code, notes, and snippets.

@demux
Created December 29, 2013 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save demux/8166922 to your computer and use it in GitHub Desktop.
Save demux/8166922 to your computer and use it in GitHub Desktop.
function R($param, $default=null, $type='string') {
if(!isset($_REQUEST[$param]))
return $default;
$r = $_REQUEST[$param];
if($type === 'bool' || $type === 'boolean') {
if($r === 'false' || $r === 'no')
return false;
return !empty($r);
}
settype($r, $type);
return $r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment