PHP has 2 closely related functions, escapeshellarg()
and escapeshellcmd()
. They both seem to do similar things, namely help make a string safer to use in system()
/exec()
/etc.
Which one should I use? I just want to be able to take some user input and run a command on it, and not have everything blow up. If PHP had an exec-type-function that took an array of strings (like argv), which bypasses the shell, I'd use that. Similar to Python's subprocess.call()
function.