Retrieve Options like Bash in Php : getopt()
Simply retrieve and use Options passed from command line to php
#!/usr/bin/php <?php /* @ Options without ":" do not accept any argument @ Options with a single ":" require an argument. No argument input will cause an error @ Options with a double "::" accept an argument. No argument input won't cause any error */ $shortopts = "vhr:o::"; /* Behave of longopts is exactly the same of short ones */ $longopts = array( "verbose", "help", "required:", "optional::", ); $options = getopt($shortopts, $longopts); var_dump($options); ?>