Let's say I want to execute the command mycommand
with PHP shell_exec()
10 times. Should I do a bash loop:
shell_exec('for i in {1 .. 10} do mycommand -i done');
or rather a PHP loop:
for($i = 1; $i <=10; ++$i) { shell_exec('mycommand -'.$i); }
What are the reasons (security, performance, style, ...) to choose one over the other?