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

Unlock the full course today

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

Directory basics

Directory basics - PHP Tutorial

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

Start my 1-month free trial

Directory basics

- [Instructor] In this chapter, we're going to learn to work with directories in PHP, starting with the basics. We've already learned several PHP functions which are related to directories. In the last chapter, we saw dirname, which returns the parent directory of a file or directory, is_dir, which returns true if a path is the path to a directory, file_exists works on directories too, and then is_readable, is_writable, and is_executable can check the directory permissions. In this movie, I want us to look at two more; getcwd, the cwd stands for the current working directory. If you're a Unix user, you might recognize it as being similar to the pwd command, the path to the working directory, and then the function chdir, short for change directory. This is similar to the CD command that Unix and Windows command line users use in order to change directories. Let's see how we can use them. In our PHP sandbox, let's create…

Contents