Jump to content

system command


Branden Wagner

Recommended Posts

I really don't know the nitty gritty of the differences between these 2 commands, but I always use exec because it returns my output nicely in an array. The following shows the definitions from tht PHP documentation:
[code]string system ( string command [, int return_var])

system() is just like the C version of the function in that it executes the given command and outputs
the result. If a variable is provided as the second argument, then the return status code of the executed
command will be written to this variable.

[/code]
[code]string exec ( string command [, array output [, int return_var]])

exec() executes the given command, however it does not output anything. It simply returns 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. If the output
argument is present, then the specified array will be filled with every line of output from the command.

[/code]
Link to comment
Share on other sites

[quote author=ronverdonk link=topic=103143.msg411716#msg411716 date=1155043827]
I really don't know the nitty gritty of the differences between these 2 commands
[/quote]

If you read the quotes you posted, then you would know that system outputs the result and exec returns the last line of the result.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.