Function __global->getopt

Definitions

sources_custom/phpstub.php

  • Gets options from the command line argument list.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$options string No No required parameter N/A N/A Each character in this string will be used as option characters and matched against options passed to the script starting with a single hyphen (-)
$longopts array No No [] N/A N/A Each element in this array will be used as option strings and matched against options passed to the script starting with two hyphens (--)
&$optind integer Yes No 0 N/A N/A The index where argument parsing stopped

Returns

  • Map of options
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Gets options from the command line argument list.
 *
 * @param  string $options Each character in this string will be used as option characters and matched against options passed to the script starting with a single hyphen (-)
 * @param  array $longopts Each element in this array will be used as option strings and matched against options passed to the script starting with two hyphens (--)
 * @param  integer $optind The index where argument parsing stopped
 * @return array Map of options
 */

function getopt(string $options, array $longopts = [], int &$optind = 0) : array