PHP code example of samejack / php-argv

1. Go to this page and download the library: Download samejack/php-argv library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

samejack / php-argv example snippets



vParser = new \samejack\PHP\ArgvParser();

$string = '-h 127.0.0.1 -u=user -p passwd --debug --max-size=3 test';

print_r($argvParser->parseConfigs($string));

Array
(
    [h] => 127.0.0.1
    [u] => user
    [p] => passwd
    [debug] => 1
    [max-size] => 3
    [test] => 1
)