Re: Directory separators on Windows

From: Date: Fri, 31 Mar 2017 04:39:17 +0000
Subject: Re: Directory separators on Windows
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-98696@lists.php.net to get a copy of this message
On Mar 31, 2017 8:19 AM, "S.A.N" <ua.san.alex@gmail.com> wrote: > Another option would be to create a function that converts all slashes in a > given input string to whatever the directory seperator should be on that > platform. This way, devs wouldn't have to deal with bulky aliases like > DIRECTORY_SEPERATOR cluttering up their code. > > For example: > > <?php > > print convert_seperators( '/some\directory/' ); > > ?> > > The above would output "/some/directory" on Linux and "\some\directory" on > Windows. +1 Can be used, for convert NAMESPACE to filepath in autoload ) <?php function __autoload($path) { include convert_seperators($path); } On Windows, it is what realpath does. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.internals (#98696) next »