How to hide "system()" output?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I want to see from php-file list of files which are in directory, where
is the given php-file. To do so, I put in the php-file the following

<?php $sys = system("ls") ?>

Then I would like to work with string $sys. However, in the place where
the "system()" is executed, php-file print on screen result of the
execution. I would like to avoid this. Do you know how I can do it?

Re: How to hide "system()" output? wrote:
Quoted text here. Click to load it

$sys = `ls`;

Note that the command is enclosed in backticks (`), not single
quotes (').

Also, you may want to avoid program execution calls, because
they may not be available on your hosting service.  Consider
using opendir()/readdir() instead:


Re: How to hide "system()" output?

On 6 Apr 2005 13:36:15 -0700, wrote:

Quoted text here. Click to load it

 In this case, use opendir() and readdir() instead.

 Or to answer the specific question, read the manual for system(), which points
to the related function exec(). But don't use that.

< Space: disk usage analysis tool

Site Timeline