Simple class to wrap getopt()
I've coded a simple class to make use of getopt() PHP function.
Simple usage:
$options = new SimpleOpt($shortopts, $longopts);
// dies if not provided
$required = $options->getRequiredOption('r');
// if '-o' option is not given, returns 'default'
$optional = $options->getOption('o', 'default');
Source at GitHub.
Written by Felipe Pisa
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Related Tags
#php
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#