Documentation

Request
in package

Should be used for getting request data for processing pages.

For display pages, see Smr\Session::getRequestVar.

Table of Contents

Methods

get()  : string
Returns index value as a (trimmed) string.
getArray()  : array<int, string>
Returns index value as an array of strings with integer keys.
getBool()  : bool
Returns index value as a boolean for boolean-like inputs.
getFloat()  : float
Returns index value as a float.
getInt()  : int
Returns index value as an integer.
getIntArray()  : array<int, int>
Returns index value as an array of integers with integer keys.
getVar()  : string
Returns index value as a string from either $_REQUEST or $var.
getVarInt()  : int
Like getVar, but returns an int instead of a string.
getVarIntArray()  : array<int, int>
Like getVar, but returns an array of ints instead of a string.
has()  : bool
Returns true if index is set.
getVarX()  : mixed
Helper function to avoid code duplication in getVar* functions.

Methods

get()

Returns index value as a (trimmed) string.

public static get(string $index[, string $default = null ]) : string
Parameters
$index : string
$default : string = null
Return values
string

getArray()

Returns index value as an array of strings with integer keys.

public static getArray(string $index[, array<int, string>|null $default = null ]) : array<int, string>
Parameters
$index : string
$default : array<int, string>|null = null
Return values
array<int, string>

getBool()

Returns index value as a boolean for boolean-like inputs.

public static getBool(string $index[, bool $default = null ]) : bool
Parameters
$index : string
$default : bool = null
Return values
bool

getFloat()

Returns index value as a float.

public static getFloat(string $index[, float $default = null ]) : float
Parameters
$index : string
$default : float = null
Return values
float

getInt()

Returns index value as an integer.

public static getInt(string $index[, int $default = null ]) : int
Parameters
$index : string
$default : int = null
Return values
int

getIntArray()

Returns index value as an array of integers with integer keys.

public static getIntArray(string $index[, array<int, int>|null $default = null ]) : array<int, int>
Parameters
$index : string
$default : array<int, int>|null = null
Return values
array<int, int>

getVar()

Returns index value as a string from either $_REQUEST or $var.

public static getVar(string $index[, string $default = null ]) : string

This is useful for processing pages that need to handle data both from posted form inputs and from container variables.

Note that this does not save the result in $var (see Smr\Session).

Parameters
$index : string
$default : string = null
Return values
string

getVarInt()

Like getVar, but returns an int instead of a string.

public static getVarInt(string $index[, int $default = null ]) : int
Parameters
$index : string
$default : int = null
Return values
int

getVarIntArray()

Like getVar, but returns an array of ints instead of a string.

public static getVarIntArray(string $index[, array<int, int>|null $default = null ]) : array<int, int>
Parameters
$index : string
$default : array<int, int>|null = null
Return values
array<int, int>

has()

Returns true if index is set.

public static has(string $index) : bool

Note that this must be used for checkboxes, since the element is not posted if a box is unchecked.

Parameters
$index : string
Return values
bool

getVarX()

Helper function to avoid code duplication in getVar* functions.

private static getVarX(string $index, mixed $default, callable $func) : mixed
Parameters
$index : string
$default : mixed
$func : callable

        
On this page

Search results