Hi... been playing with getopt for a bit - not sure I understand how to use it efficiently.
Are there any examples of usage of getopt?
I can't narrow my search enough to find anything useful, and I don't see anything on the pear site.
I'm trying to implement the getopt code, and when I print_r the results, I see:
php -q count.php -ya 'asdf qwer'
Array
(
[0] => Array
(
[0] => Array
(
[0] => y
[1] => a
)
)
[1] => Array
(
[0] => asdf qwer
)
)
If I saw something like:
php -q count.php -ya 'asdf qwer'
Array
(
[0] => Array
(
[y] => a
)
[1] => Array
(
[0] => asdf qwer
)
)
I'd have a better change of handling the options efficiently... I must be not understanding typical usage... with an array like my modified one above, I could do things like:
$year = (isset($opts[0]['y'])) ? $opts[0]['y'] : date('Y');
How do I efficiently handle something like this with the REAL array (not my ideal one ;-)?
Thanks so much - sorry for the intrusion - if there is a better place to ask, please let me know.
m/