Native PHP vs exec()

Posted by resting on Programmers See other posts from Programmers or by resting
Published on 2013-06-25T22:34:22Z Indexed on 2013/06/26 4:28 UTC
Read the original article Hit count: 131

Filed under:

Just wondering, assuming no security issues, that is, you're in total control of the command passed to exec(), is there a difference (in terms of speed or standards) between using exec() vs native PHP?

Example just to name a few use cases:

  1. Using the DirectoryIterator vs exec(ls -1, $output), to list all files.
  2. List 100 files from the 99th file onwards (that is, file 100 to 199)
  3. Count total number of files in directory.

© Programmers or respective owner

Related posts about php