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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Tue Oct 20 20:01:25 2020 UTC