From the course: PHP Techniques: Working with Files and Directories

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Directory treasure hunt

Challenge: Directory treasure hunt - PHP Tutorial

From the course: PHP Techniques: Working with Files and Directories

Start my 1-month free trial

Challenge: Directory treasure hunt

(upbeat music) - [Instructor] It's time for another challenge assignment. This is an opportunity for you to use the techniques we've learned in the last two chapters. For this challenge, you're going to go on a treasure hunt. You will use the directory called Treasure Hunt, which is included in the exercise files. Your challenge is to write a PHP script, which will loop through all of the entries inside that directory. And you'll examine the file contents looking for the string, treasure. There's going to be more than one. Each time you find one, output the file path to HTML. At the end you'll have a list of all of the treasure locations. Let me give you a few tips to help you out. The first is start by just focusing on the current working directory. There's going to be a lot of nested directories, but just put those out of your mind to begin with and get something that works just for the current directory,…

Contents