You're creating a PHP script that should generate a list of all JPEG images in a specific directory. Which combination of PHP functions can achieve this?
- opendir(), readdir(), and substr()
- scandir(), file_get_contents(), and explode()
- glob() and file_get_contents()
- fopen() and fwrite()
To generate a list of JPEG images in a directory, you can use the opendir() and readdir() functions to iterate through files, and substr() to check file extensions. These functions are ideal for this task.
Loading...
Related Quiz
- How do you create a MySQL table using PHP?
- You have a for loop in your PHP script that is not terminating as expected. What could be the possible reasons and how would you debug this?
- In PHP, after you have finished working with a file, you should always close it using the ______ function.
- What does the expression Exception::__toString mean?
- How are variables in PHP declared?