How to get the directory name out of a file path name?
Answer / Rajni Pandey
In PHP, you can use the pathinfo() function to extract the directory name from a file path. Here's an example: `$filePath = "/var/www/example.com/files/myfile.txt"; $pathInfo = pathinfo($filePath); echo $pathInfo['dirname']; // Output: /var/www/example.com/files
| Is This Answer Correct ? | 0 Yes | 0 No |
Can we use php variable in javascript?
What is php mean?
Which is a perfect example of runtime polymorphism?
What is php in simple words?
What is the difference between $_files['userfile']['name'] and $_files['userfile']['tmp_name']?
Write a hello world program using variable?
What type of operation is needed when passing values through a form or an url?
How to open a file in php?
Which function will you use to create an array?
Why use static methods php?
What does == mean in php?
Write a program to find no of days between two dates in php?