Although PHP is most commonly used to write web applications, it can also be used for scripts that run from a command line interface (CLI). The CLI environment is a little different than the web environment, and PHP's current documentation doesn't make it easy to locate the relevant pieces.
$argccontains the number of arguments passed to the current script
$argvcontains an array of all the arguments passed to the script
$argvis always the name that was used to run the script.
getopt()parses individual arguments in a standard way
glob()is the interface to the system's file-globbing function