25
The documentation on this is rather vague, the little that exists does not clearly clarify the difference between the use and purpose of the following two PHP constants:
PATH_SEPARATOR
and
DIRECTORY_SEPARATOR
At first glance, it seems that both give us the same practical application, ie, detect the path separator in the operating system, for example the /
or \
.
But the fact that there are two constants tells me immediately that this will not be true, two things would not have been created for the same exact effect!
Reading what is present in the PHP: Predefined constants - Manual, see:
Predefined constants
The following counts are defined by this extension and will only be available when the extension was compiled with PHP or loaded dynamically during the execution.
DIRECTORY_SEPARATOR (string)
PATH_SEPARATOR (string)
I mean, I see nothing, not even a small description of the constant is present.
If you see in PHP: Predefined Constants - Manual (English), talk in ;
and ,
!?
Question
What is the difference between the two constants and their practical use for each one?
In the linux shell type
echo $PATH
in the case of Windows typeecho %path%
- will see the difference– Allyson de Paula