Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP File Handling with PHP Basic File Handling Reading Files

Teacher Russell
Teacher Russell
16,873 Points

What is the "example" directory?

I'm afraid I don't understand what they're asking for here. I thought maybe they're referring to the file function that creates an array. I'm not sure what directory they're referring to.

index.php
<?php
$files = file('example');

1 Answer

Joel Bardsley
Joel Bardsley
31,246 Points

Hi Russell,

It would have been nice if the challenge showed the file/folder structure for clarity, but just imagine you're editing index.php at the root level ("./") and you need to access a selection of files from the 'example' directory ("./example/")

You're looking for a php directory function that Alena used in an earlier video that can list files and directories inside a specified path, and also returns that list as an array (that you can store in your $files variable). If you're still stuck, don't forget to take a look in the teacher's notes.

I hope that's helped to make it more clear without giving the answer away. However, if you're still not sure where to start, let me know.

Joel

Teacher Russell
Teacher Russell
16,873 Points

THanks, perfect amount of clueage. I was living in the too recent past. Got it, I think. Thanks a lot.