logo CodeStepByStep logo

scandir_vs_glob0

Language/Type: PHP basics file io
Author: Melissa Hovik (on 2018/11/22)

Suppose a directory has the following structure:

test.php
mydir/
    images/
        puppy1.jpg
        puppy1.png
        puppy2.gif
    puppy-facts.txt
    puppy-haz-pizza.jpg

What do each of the following statements return if written in test.php? Use [] notation for any arrays and put strings in "".

scandir("mydir")
scandir("mydir/images")
glob("mydir/puppy-facts.txt")
glob("mydir/*/*")
glob("mydir/puppy*")
glob("mydir/*.jpg")
glob("mydir/*")

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.