Source for file getopt.php
Documentation is available at getopt.php
// $Id: getopt.php,v 1.3 2008/11/24 04:18:49 aidan Exp $
define('PHP_COMPAT_GETOPT_NO_VALUE', 0 );
define('PHP_COMPAT_GETOPT_VALUE_REQUIRED', 1 );
define('PHP_COMPAT_GETOPT_VALUE_OPTIONAL', 2 );
* @license LGPL - http://www.gnu.org/licenses/lgpl.html
* @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net>
* @link http://php.net/function.getopt
* @author Jim Wigginton <terrafrost@php.net>
* @version $Revision: 1.3 $
user_error('getopt() expects parameter 1 to be string, array given', E_USER_WARNING );
for ($i = 1; $i < $argc; $i++ ) {
$pos = strpos($argv[$i], '=');
$value = $pos === false ? null : substr($argv[$i], $pos + 1 );
case $argv[$i][0 ] == '-' && preg_match('#' . preg_quote($argv[$i][1 ], '#') . '(:{0,2})#', $options, $matches):
$value = substr($argv[$i], 2 );
$argv[$i] = '-' . $value;
if (isset ($output[$opt]) && is_array($output[$opt])) {
$output[$opt][count($output[$opt]) - 1 ] = $argv[$i];
$output[$opt] = $argv[$i];
case !isset ($output[$opt]):
$output[$opt] = array ($output[$opt], false );
case !isset ($output[$opt]):
$output[$opt][] = $value;
$output[$opt] = array ($output[$opt], $value);
$value = !empty ($value) ? $value : false;
case !isset ($output[$opt]):
$output[$opt][] = $value;
$output[$opt] = array ($output[$opt], $value);
function getopt($options, $longopts = NULL ) {
Documentation generated on Mon, 11 Mar 2019 15:26:35 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|