en
I don’t like php’s getopt function, because it’s too crippled.
I’ve started a write a replacement function.
It has more options, is easier to handle and returns all non parameter arguments.
Fell free to use or improve it:
Code / Docs: https://github.com/alexkazik/getopts
Update 2011-04-19: Added License and a small improvement.
de
Ich mag die Funktion getopt von php nicht, da sie zu verstümmelt ist.
Ich habe angefangen einen erstaz zu schreiben.
Sie hat mehr Optionen, ist einfacher zu bedienen und liefert auch alle nicht Options Parameter zurück.
Benutzte oder verbessere sie:
Code / Docs: https://github.com/alexkazik/getopts
Update 2011-04-19: Added License and a small improvement.
Hi Alex, I’d be a little more comfortable using (and maybe contributing to) getopts() if it had a license. If you don’t have a strong preference, I’d suggest that you go with a modified BSD license.
Is this code public domain?
Are hyphens not allowed in GNU-style long options? They are conventional…
http://www.gnu.org/prep/standards/standards.html#Command_002dLine-Interfaces
http://www.gnu.org/prep/standards/standards.html#Option-Table
For example, see man pages for: diff(1), curl(1), mysql(1)
@Paul A. Houle, Chris:
The license is now mentioned. Can you live with it?
@tom:
Thanks for your comment. I’ve fixed/extended the source.
@all:
sorry for the late answer, I had trouble with the notification mails.
I have found a typo: “Missing artument to option” should of course be “Missing argument to option”
There is a PHP Notice regarding the split() function.
“Deprecated: Function split() is deprecated in …”
My PHP version is PHP 5.3.5-1ubuntu7.2
@sebastian:
Thanks for your reply, I’ll fix that.
Your license choice is a little problematic.
http://wiki.creativecommons.org/FAQ#Can_I_use_a_Creative_Commons_license_for_software.3F
If you really want to use a Create Commons license, the CC0 license would make it easy for people to use your code. The BSD license would be a good choice that seems compatible with your intent.