php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #70353 predefined constant missing
Submitted: 2015-08-25 08:55 UTC Modified: 2015-08-25 09:08 UTC
From: paulo dot castro48 at gmail dot com Assigned: salathe (profile)
Status: Not a bug Package: Documentation problem
PHP Version: 5.6.13RC1 OS: WIN
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: paulo dot castro48 at gmail dot com
New email:
PHP Version: OS:

 

 [2015-08-25 08:55 UTC] paulo dot castro48 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/reserved.constants
---

There is no predefined slash that depends on OS
this is a problem when working in both linux and windows you have to change the slashed everytime you switch servers.

define('PHP_SLASH', ( preg_match( '/^WIN/', PHP_OS ) ) ? "\\" : "/" );

echo PHP_SLASH;


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-25 09:08 UTC] salathe@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: salathe
 [2015-08-25 09:09 UTC] salathe@php.net
It looks like you want DIRECTORY_SEPARATOR [1]. The value of this constant is \ (backslash) on Windows, and / (forward slash) elsewhere.

[1] http://php.net/manual/en/dir.constants.php#constant.directory-separator
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 17:01:33 2025 UTC