PHP - exec example

    
    exec('ls', $out);
    var_dump($out);
    // output
    // Array
    // (
    //     [0] => file_1.txt
    //     [1] => file_2.txt
    //     [2] => file_3.txt
    // )
    
    
    exec('whoami', $out);
    print_r($out);
    // output
    // Array
    // (
    //     [0] => root
    // )
    
    
    exec('pwd', $out);
    print_r($out);
    // output
    // Array
    // (
    //     [0] => /current/working/directory
    // )
    

Comments