Categories:
.NET (357)
C (330)
C++ (184)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (2)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Struts (1)
Windows (1)
XHTML (173)
Other Resources:
How To Break a File Path Name into Parts
How To Break a File Path Name into Parts? - PHP Script Tips - Working with Directoris and Files
✍: FYIcenter.com
If you have a file name, and want to get different parts of the file name, you can use the pathinfo() function. It breaks the file name into 3 parts: directory name, file base name and file extension; and returns them in an array. Here is a PHP script example on how to use pathinfo():
<?php
$pathName = "/temp/download/todo.txt";
$parts = pathinfo($pathName);
print_r($parts);
print("\n");
?>
This script will print:
Array
(
[dirname] => /temp/download
[basename] => todo.txt
[extension] => txt
)
2007-04-23, 5673👍, 0💬
Popular Posts:
How Many Tags Are Defined in HTML 4.01? There are 77 tags defined in HTML 4.01: a abbr acronym addre...
Can you explain project life cycle ? Figure :- 12.2 Life cycle of a project There are five stages of...
What is difference between ADPATCH and OPATCH ? # ADPATCH is utility to apply ORACLE application Pat...
What is the quickest sorting method to use? The answer depends on what you mean by quickest. For mos...
What is hashing? To hash means to grind up, and that's essentially what hashing is all about. The he...