Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to manipulate an array in php

Status
Not open for further replies.

darklich14

Programmer
Feb 14, 2001
3
US
I have an array of filenames, but now I need to figure out someway how to get the files which are not .gif or .htm to be taken out of the array. the source is at


and the actual output of the source at


if you look through the array, you will notice there are .php files, etc. If I could get the input to work with wildcards, that would work, but I need to know how to use these wildcards!
 
//use eregi() if you want to be case INSENSITIVE
// if you check the files when you read them in change
//the for to a while and check to see if the "file" is a
//file then put it in the array if the "type" is right

$count = 0;
for ($i = 0; $i < sizeof($ARRAY); $i++)
{
if (ereg(&quot;.gif$&quot;, $ARRAY[$i]) || ereg(&quot;.html$&quot;, $ARRAY[$i]))
{
$NEWARRAY[$count] = $ARRAY[$i];
$count++;
}// if

}// for
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top