I've got a file structure at work that looks like this:
root/
├─ directory/
│ ├─ main.php
│ ├─ code1.php
│ ├─ code2.php
│ ├─ script.php
script.php
The main.php
script has several include()
statements, and a couple of them look like this: include(code1.php)
, include(code2.php)
. This makes perfect sense to me, as it's just looking the code
script within directory
, since directory
is the cwd
.
But then there's a line include(.\script.php)
. I was cleaning up the codebase a bit (git was recently set up) and was looking to remove one of the duplicae script.php
files, and based on the include statement, I removed the one inside of directory
and left the one in root
, because I thought the .\
syntax meant to jump up one level and search there instead.
Well, that broke everything, and reverting the commit and putting script.php
back into directory
fixed it. I've done some searching and there's a very similar question here asking about the difference between just using a ..\
and using \..\
, which I understand, but my question is what is the purpose of using just one period, like .\
? Clearly it's not to jump up one level like I thought, but it also seems to be unnecessary when looking for a file that exists at the same level as the original script that was called?
Thanks in advance!