View Single Post

  #1 (permalink)  
Old 12-28-2007
The87Boy
 
Posts: n/a
Default PHP Cli arguments

I am trying to make a PHP Cli program, but there is something I do not
know what to do

If we take an example:
php5 test.php --add Hello World I am great --delete World great --sort
test.txt

I want to have an array with the commands, that look like this:
Array (
[--add] => Array('Hello', 'World', 'I', 'am', 'great'),
[--delete] => Array('World', 'great'),
['--sort'] => Array()
);

I have made 2 arrays; one with commands that takes arguments and
another with commands that takes no arguments. And in the earlier
example, the --sort command takes no argument.

Now I do not now how to make the finished array
Reply With Quote