Last active
September 24, 2017 12:57
-
-
Save isu3ru/d65a9bd5c8ab0806aa7aa3e74ee960c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function p($key, $num = FALSE) | |
{ | |
$var = filter_input(INPUT_POST, $key); | |
if ($var) { | |
if (is_array($var)) { | |
return $var; | |
} | |
if (!is_numeric($var) && $num && empty($var)) { | |
return intval(0); | |
} else { | |
return $var; | |
} | |
} else { | |
return $num ? intval(0) : FALSE; | |
} | |
} | |
function g($key) | |
{ | |
$var = filter_input(INPUT_GET, $key); | |
return $var ? $var : ''; | |
} | |
function s($key) | |
{ | |
$var = filter_input(INPUT_SESSION, $key); | |
return $var ? $var : ''; | |
} | |
function c($key) | |
{ | |
return array_key_exists($key, $_COOKIE) ? $_COOKIE[$key] : ''; | |
} | |
function a($key, $array, $default = '') | |
{ | |
if (!is_array($array)) { | |
return 0; | |
} | |
return array_key_exists($key, $array) ? ((empty($array[$key])) ? $default : $array[$key]) : $default; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment