What’s the difference between . / and .. / in php?

Asked

Viewed 51 times

1

I’ve been trying to put a part of my code with ../diretório/arquivo.php, It didn’t work at all, so I accidentally only put one point, it worked, is there any difference between these? I didn’t even know about the other one, I tried to research but I can’t find anything related by incredible that it seems...

1 answer

2


In this case, the problem is not PHP itself. But in the nomenclatures of these special classes to designate a path.

Single point (.) represents the folder itself, that is, the path you are already working on.

Double points (..) are used to indicate a higher path, that is, if I am in the "C: archivesPersonals", if I want to "go up" a house in the directory tree, I use double points.

A curiosity: in Windows, when we create a folder named "." or ".." it returns an unexpected error message, rather than detailing the cause.

EDIT: (Thanks to @Itwasntme)

For query purposes, you can find more advanced content on microsoft website.

  • 1

    Good afternoon friend, thanks for the help, I’m a little confused, because in the case I used (.) as if it was (..), and the strange thing is that it’s working, my goal was to go back to a previous folder, enter another folder and reference a file in it and the (.) is working normally for this, as if it were (..), wanted to understand why this happened

  • Thank you very much personally!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.