|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #61298 Add an short alias DS for DIRECTORY_SEPARATOR
Submitted: 2012-03-06 06:39 UTC Modified: 2012-03-06 10:36 UTC
From: cornelius dot howl at gmail dot com Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 5.4.0 OS:
Private report: No CVE-ID: None
 [2012-03-06 06:39 UTC] cornelius dot howl at gmail dot com
Really hope there is a DS alias for DIRECTORY_SEPARATOR, and PATH_SEPARATOR.

because it's too easy to make a typo, these keywords are hard to type.

$path = 'root' . DS . 'to' . 'path' . DS . 'subpath' . DS . 'subpath' . DS . 

rather than:

$path = 'root' . DIRECTORY_SEPARATOR . 'to' . 'path' . DIRECTORY_SEPARATOR . 
'subpath' . DIRECTORY_SEPARATOR . 'subpath' . DIRECTORY_SEPARATOR . 'file.txt';

the later is uglier. 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-06 10:36 UTC]
-Status: Open +Status: Not a bug
 [2012-03-06 10:36 UTC]
Constants should have clear names to help readability. If you want something shorter you can easily do
or using define(). If you have issue typing names correctly you can also get an IDE.
 [2014-06-09 14:22 UTC] hanskrentel at yahoo dot de
Also nobody needs this constant. You can just use '/' (slash), it works.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 09 00:01:27 2023 UTC