Function __global->either_param_string

Definitions

sources/global2.php

  • Get a parameter value (either POST *or* GET, i.e. like $_REQUEST[$name]), or the default if neither can be found.Implements additional security over the direct PHP access mechanism which should not be used.If the requested POST parameter is an array, it will be returned as a comma-delimited string.Use with caution, as this has very limited CSRF protection compared to post_param_string.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$name ID_TEXT No No required parameter N/A N/A The name of the parameter to get
$default ?~mixed No No False N/A N/A The default value to give the parameter if the parameter value is not defined (null: allow missing parameter) (false: give error on missing parameter)
$filters integer No No 7871 N/A N/A A bitmask of INPUT_FILTER_* filters

Returns

  • The parameter value (null: missing)
  • Type: ?string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get a parameter value (either POST *or* GET, i.e. like $_REQUEST[$name]), or the default if neither can be found.Implements additional security over the direct PHP access mechanism which should not be used.If the requested POST parameter is an array, it will be returned as a comma-delimited string.Use with caution, as this has very limited CSRF protection compared to post_param_string.
 *
 * @param  ID_TEXT $name The name of the parameter to get
 * @param  ?~mixed $default The default value to give the parameter if the parameter value is not defined (null: allow missing parameter) (false: give error on missing parameter)
 * @param  integer $filters A bitmask of INPUT_FILTER_* filters
 * @return ?string The parameter value (null: missing)
 */

function either_param_string(string $name, $default = false, int $filters = 7871) : ?string
 

sources/minikernel.php

  • Get a value (either POST [u]or[/u] GET), or the default if neither can be found.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$name ID_TEXT No No required parameter N/A N/A The name of the parameter to get
$default ?~mixed No No False N/A N/A The default value to give the parameter if the parameter value is not defined (null: allow missing parameter) (false: give error on missing parameter)

Returns

  • The value of the parameter (null: not there, and default was null)
  • Type: ?string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get a value (either POST [u]or[/u] GET), or the default if neither can be found.
 *
 * @param  ID_TEXT $name The name of the parameter to get
 * @param  ?~mixed $default The default value to give the parameter if the parameter value is not defined (null: allow missing parameter) (false: give error on missing parameter)
 * @return ?string The value of the parameter (null: not there, and default was null)
 */

function either_param_string(string $name, $default = false) : ?string