Kingsta1993
Kingsta1993

Reputation: 25

PHP Shell_Exec not working with variable

I'm trying to pass a variable into shell_exec, I've looked at other tutorials but they still dont help.

I want to pass $var[1] into the shell_exec so it will just display this specific file or directory's information

$output = shell_exec('ls -l'.$var[1]);

Upvotes: 0

Views: 374

Answers (1)

baao
baao

Reputation: 73211

You should add some whitespace:

$output = shell_exec('ls -l '.$var[1]);
                        // ^here

Upvotes: 1

Related Questions