File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes PHP and the fly likes Confusing slashes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Languages » PHP
Bookmark "Confusing slashes" Watch "Confusing slashes" New topic

Confusing slashes

egbai mmumene
Ranch Hand

Joined: Sep 18, 2012
Posts: 46
I'm trying to set a directory on a php page but the book i'm using uses the back slash"/" instead of the front slash"\" although both aren't working in displaying my image
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

backslash = \
forward slash = /

Backslash is only used on Windows.

[Asking smart questions] [About Bear] [Books by Bear]
Nick Charles
Ranch Hand

Joined: Oct 09, 2011
Posts: 71

I usually use forward slashes (/) in file patchs because backwards slashes (\) are treated as escaped characters in PHP (and Java) strings and thus can lead to surprising results.

Of course, this doesn't solve the problem you are having. To solve that problem, change your file references to use the correct relative path. If you need more help than that, please post the code you are using, and also post the exact location of the file you are attempting to access (full path location for both the PHP file containing the code and the file being referenced, please).
I agree. Here's the link:
subject: Confusing slashes
It's not a secret anymore!