Jump to content
Larry Ullman's Book Forums

Confused With Slash And Backslash


Recommended Posts

I'm very surprised: I recently received php code written on a PC with a link containing backslash:

<?php 
	include_once('include\dbConnect.php');
?>
(...)

This code didn't work (the table content was not displayed). Once I replaced the backslash with slash, the code worked again well.

 

Maybe obvious for most of you, but it is something I had never heard about!

 

Now, I wonder what the "slashed" code would give on a PC?

Link to comment
Share on other sites

On Windows, the backslash is commonly used in paths. However, the backslash is the escape character, so that line is read as \d (and escaping "d" doesn't do anything). The options are to use a double backslash (\\) or use a forward slash (/). 

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...