Re: Show Filename using Wildcards

From: Date: Thu, 29 Mar 2007 19:36:48 +0000
Subject: Re: Show Filename using Wildcards
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-251666@lists.php.net to get a copy of this message
Rahul Sitaram Johari wrote:
Ave, Yes well, I did kind of figure out that I have to scan through contents of a directory, pull up a file list, and then do some kind of pattern matching to narrow down to the files I need. But at this moment I'm kinda struggling with the directory & file functions - haven't really dwelled into those deeply before. Good place to start:
http://www.php.net/manual/en/function.opendir.php Some good examples on getting contents of a directory... -B
But yes, your suggestions seem more then likely what I'll be hitting at some stage. Thanks. On 3/29/07 3:22 PM, "Brad Bonkoski" <bbonkoski@mediaguide.com> wrote:
I'm sure there are many options... I'm also assuming you are pulling from a file system and not a database... So, loop through the directory and do something like this: $phone_num = XXX $cur_file = xxx if( strncmp($phone_num, $cur_file, strlen($phone_num)) == 0 )
    //Matches
else
    //No Match
Ref: http://us3.php.net/manual/en/function.strncmp.php (for case insensitive: http://us3.php.net/manual/en/function.strncasecmp.php) -B
    


« previous php.general (#251666) next »