What is the difference between exec(), system() and passthru()?

Asked

Viewed 401 times

6

What are the differences between these functions? Is there any specific situation to use each function? If there is, give examples of these situations.

1 answer

6


In that OS response in English, it is said:

exec() - calls a system command, and you handle the output yourself

system() - executes a system command and displays output immediately (usually text)

passthru() - executes a system command, from which you want the "raw" return. Maybe in binary

I suggest you don’t use any of them, as it generates highly non-transferable code.

Documentation (in Portuguese)

Function system
Function exec
Function passthru

  • I did not understand the phrase "since general code highly non portable."

  • gera* hauahau, typed wrong

Browser other questions tagged

You are not signed in. Login or sign up in order to post.