PHP code example of chh / shellwords

1. Go to this page and download the library: Download chh/shellwords 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/ */

    

chh / shellwords example snippets




use CHH\Shellwords;

$input = "'this is quoted' foo bar";

var_export(Shellwords::split($input));
# Output:
# array("this is quoted", "foo", "bar")



use CHH\Shellwords;

$cmd = Shellwords::join(["ls", "-l", "some directory with spaces"]);
# 'ls' '-l' 'some directory with spaces'

`$cmd`;