aximbigfan Posted April 16, 2008 Share Posted April 16, 2008 I created a PHP registry system, that emulates the Windows registry. Oen thign is, that the entries are storedin files, and the file names are like this: <DIR>#<KEYNAME>.PRK What I want to do, is parse these filenames into array so that I have... * The <DIR> * The <Keyname> How can I do this? The "#" separates the 2, and the filenames are URLencoded. The file extension also needs to be ignored. Chris Link to comment https://forums.phpfreaks.com/topic/101294-solved-parse-filename-into-bits/ Share on other sites More sharing options...
doni49 Posted April 16, 2008 Share Posted April 16, 2008 $f1 = "dir1#key1.PRK" //this will create an array--the last element will be the filename with the extension //all other elements will be the folder names preceeding the filename. $f2 = explode("#",$f1); $filename = $f2[count($f2)-1]; $filename_noextension = explode(".", $filename); $filename_noextension = $filename_noextension[0]; For info on these functions: www.php.net/explode www.php.net/count Link to comment https://forums.phpfreaks.com/topic/101294-solved-parse-filename-into-bits/#findComment-518106 Share on other sites More sharing options...
aximbigfan Posted April 16, 2008 Author Share Posted April 16, 2008 Thanks a bunch! Chris Link to comment https://forums.phpfreaks.com/topic/101294-solved-parse-filename-into-bits/#findComment-518112 Share on other sites More sharing options...
doni49 Posted April 16, 2008 Share Posted April 16, 2008 NP Link to comment https://forums.phpfreaks.com/topic/101294-solved-parse-filename-into-bits/#findComment-518113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.