php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #43046 Introduce constant NAMESPACE_SEPARATOR
Submitted: 2007-10-19 22:21 UTC Modified: 2007-10-20 14:52 UTC
From: lars at strojny dot net Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.3CVS-2007-10-19 (snap) OS: Gentoo Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lars at strojny dot net
New email:
PHP Version: OS:

 

 [2007-10-19 22:21 UTC] lars at strojny dot net
Description:
------------
A constant for the namespace separator should be defined. I would propose to define NAMESPACE_SEPARATOR to "::", similiar to DIRECTORY_SEPARATOR.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-19 22:30 UTC] derick@php.net
Why is this useful?
 [2007-10-19 22:32 UTC] lars at strojny dot net
Sorry, wrong version.
 [2007-10-19 22:40 UTC] lars at strojny dot net
Could help to keep a codebase cleaner and better readable. Take a look at:
$path = str_replace('::', DIRECTORY_SEPARATOR, $class_name);
vs.
$path = str_replace(NAMESPACE_SEPARATOR, DIRECTORY_SEPARATOR, $class_name);
is - in my opinion - easier to understand and better to read.
 [2007-10-19 23:10 UTC] lars at strojny dot net
Sorry, changed summary by accident
 [2007-10-20 14:52 UTC] johannes@php.net
The reason for DIRECTORY_SEPARATOR is that the value is platform dependent, the namespace separator isn't.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 19:01:29 2025 UTC