How the Program Execution Functions Work

The program execution functions can be separated into two groups.

The first group consists of escapeshellarg() and escapeshellcmd(). These functions help make input safer to pass to the command interpreter by quoting the input and/or escaping control characters within it. See the individual function writeups for more details.

The remaining functions— exec(), passthru(), and system()—are used to execute commands in the system’s command interpreter. (In UNIX-like operating systems, this is sometimes called the shell.) The functions in this group share a set of common behaviors:

  • Each of them attempts to execute a command (or a series of commands) using the command interpreter.

  • None of them can deal with interactive ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.