How do I properly split a PATH variable in PHP?

environment, operating-system, path, php, variables

Solution

You can use the `PATH_SEPARATOR` constant, then the `DIRECTORY_SEPARATOR` constant to split the path if needed. See `Directory Predefined Constants`

Problem

I want to split ``` $path = getenv('PATH'); ``` into its components. How do I determine the separator char in an os-dependent fashion?

Original source