So I have this PHP code which is pretty simple.
$string = exec("ls foo");
In foo
I have 4 files
foo
bar
hi
bye
But echo $string
returns bye
How can I make it return all of the files? Is it not working because ls
separates by tabs?
So I have this PHP code which is pretty simple.
$string = exec("ls foo");
In foo
I have 4 files
foo
bar
hi
bye
But echo $string
returns bye
How can I make it return all of the files? Is it not working because ls
separates by tabs?
From the manual: http://php.net/manual/en/function.exec.php
Return Values
The last line from the result of the command. If you need to execute a command and have all the data from the command passed directly back without any interference, use the ˋpassthru()ˋ function.