Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,244 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.