Na przykład coś takiego:
class Input {
protected
static function value
(array $array, $key = null, $default = null) {
return $key === null ?
$array : ($array[$key]
$default); }
public static function get
($key = null, $default = null) {
return static::value($_GET, $key, $default); }
public static function post
($key = null, $default = null) {
return static::value($_POST, $key, $default); }
}
Sposób użycia:
Input::get() - wszystkie wartości GET
Input::post() - wszystkie wartości POST
Input::get('cokolwiek') - wartość $_GET['cokolwiek'] lub null, jeśli nie istnieje
Input::post('cokolwiek') - wartość $_POST['cokolwiek'] lub null, jeśli nie istnieje
Input::get('cokolwiek', 'jagoda') - wartość $_GET['cokolwiek'] lub "jagoda", jeśli nie istnieje
Input::post('cokolwiek') - wartość $_POST['cokolwiek'] lub "jagoda", jeśli nie istnieje
EDIT

to dwa znaki zapytania obok siebie. Widzę, że to forum nadal nie ogarnia, że w kodzie nie chcemy emotikonek