Tuesday, August 5, 2014

PHP - exec() vs system() vs passthru()

I've learned from experience.
Similarities : They are all used to execute system commands
shell_exec()  - I will execute your command and return the full string of the result.

exec()  -  "shell_exec"  stop copying my feature... *works the same as shell_exec

system()    -  I will run your command but I will only return the last line . Please use me if you only                                  want a one liner output

passthru() - I will run your command and proceed immediately with the next line of code. The output                           will be sent to output buffer dont worry about me.

No comments:

Post a Comment