How to get a platform independent directory separator in PHP?

Votes : 3.3
I have tobuild, modify or change absolute path in PHP programatically sometimes. I have tried to get absolute path everytime, return different absolute path pattern between local PHP server and hosting PHP server.
  • In local server - c:\wamp\my_project\index.php
  • In hosting server - /public_html/my_project/index.php
I need to get current directory separator in PHP by using wamp server?

Your Answer

1 Answer

try this  php constant
(string) DIRECTORY_SEPARATOR - return ( / or \ );

What is the codrate ? is a standard, fast cross browsing and highly versatile site. It is useful for many large number of Program Development Industries. So you can get support form Codrators , who are the codrate's joiners around world to help your program developments, You can answer other codrator's questions. Communicate with them. Share your knowledge with them. Do you have an interest in programming, So publish your articles about programming. It will help to maintain your professional co-profile. Actually is not such as a regular web site. It will be gave new experience, best narrow cross-browser view, reduce processing time to receive browsing request, it's mean do not wasting your time to browsing codrate's web pages because it has been upgrade always modern coding ways. So, what do you waiting for ?. Try your own.

Copyright 2015 Pride - Company. Design by Esila