lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at
PHP: parent directory
Question: what's the best method for dynamically obtaining a parent directory, e.g. the parent directory to the document root?

Answer: quite simple

// PARENT DIR: dirname(dirname($path_to_file))

# parent to current file

# parent to document root (outside web tree)