PHP dirname() Function
In this code snippet, we’ll learn about the dirname() function in PHP. The dirname() function takes in a path string and gives you the parent directory of it. A second parameter can be added where you can specify how many levels up you want to go.