On Fri, 2011-01-07 at 11:31 -0800, David Harkness wrote: > On Fri, Jan 7, 2011 at 10:41 AM, larry@xxxxxxxxxxxxxxxx < > larry@xxxxxxxxxxxxxxxx> wrote: > > > "Application" is perhaps a misnomer. I'm not looking at rewriting Emacs or > > anything. Just some batch processing that would get run as: > > > > php myscript.php --config=foo.xml --setting-1=stuff > > > For this I used getopt() which worked well enough. Long options don't work > on Windows IIRC (check the docs), but you can easily get arguments from > short options. An example for the tool I wrote is > > src/sitemap.php -s 28372 -d mydomain.com -l debug -p -z 9 -b sitemaps -o > xml > > The code that parses the options is very straightforward. If you already use > Zend Framework, it has its own CLI library I think. > > David getopt() doesn't work well on Windows on early versions of PHP 5.2 at all, as I found to my dismay at work. As an alternative, I used the $GLOBALS['argv'] array, which contains the command line arguments, although not in as nice a format as you get them from getopt() Thanks, Ash http://www.ashleysheridan.co.uk