They do exactly what their names are. If your code is running by referring a class in another file which exists in some other directory then these both methods will return different results.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 9 years, 9 months ago. Active 3 months ago. Viewed k times.
I have a php page inside a folder on my website. Improve this question. Satch Satch Add a comment. Active Oldest Votes. Eg: main. Improve this answer. Woody 1, 2 2 gold badges 16 16 silver badges 24 24 bronze badges. Returning me all files but two garbage files named ".
I don't have any file named ". I need to remove. This is the most eloquent solution, at least for the usage I wanted. Dika 1, 4 4 gold badges 28 28 silver badges 44 44 bronze badges. It's due to operator precidence. Danijel Danijel You could just try the scandir Path function. David Arenburg Ad Kahn Ad Kahn 4 4 silver badges 6 6 bronze badges. Community Bot 1 1 1 silver badge.
Peter Mortensen Chandresh Chandresh 2 2 silver badges 7 7 bronze badges. Prashant Goel Prashant Goel 4 4 silver badges 6 6 bronze badges. Kaloy Kaloy 9 9 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Stack Gives Back Here's a few example.
Before you try these out, create a new PHP page and save it as fileDir. To get the exact path of file, then, you can use realpath. In between the round brackets of the function, type the name of the file.
To get the names of the folders, you can use the dirname function.
0コメント