PHP » I/O » system()

Syntax:
string system(string command, int return_value)
command
Command to be executed.
return_value
Integer for the return value of the command.

Executes a command.

This function executes a command in a shell and returns the last line of the output. Instead of returning the output of the command in a variable, it is sent directly to the browser. The optional return_value holds the return value of the command.

Examples

Code:
<pre>
<?php

system("mount", $ret);

?>
</pre>
Output:
/dev/sda1 on / type ext3 (rw)
none on /proc type proc (rw)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
none on /dev/shm type tmpfs (rw)
Explanation:

system() and mount are used to print the mounted filesystems.

See Also: