[UPHPU] Help me speed this up. Possibly a regex question?

Richard K Miller richardkmiller at gmail.com
Tue Feb 12 17:58:41 MST 2008


On Feb 12, 2008, at 4:35 PM, Ash wrote:

> Is there a faster way to do this? Explanation below if this doesn't  
> make sense.
>
> $infile = "J-$Month-rs.pdf";
>
> if (!file_exists($infile)){
> $infile = "J-$Month-rp.pdf";
>        }
> if (!file_exists($infile)){
> $infile = "J-$Month-ms.pdf";
>        }
> if (!file_exists($infile)){
> $infile = "J-$Month-mp.pdf";
>        }
> if (!file_exists($infile)){
> $infile = "J-$Month-rx.pdf";
>        }
> if (!file_exists($infile)){
> $infile = "J-$Month-mx.pdf";
>        }
> if (!file_exists($infile)){
> $infile = "J-$Month-xs.pdf";
>        }
> if (!file_exists($infile)){
> $infile = "J-$Month-xp.pdf";
>        }
> if (!file_exists($infile)){
> $infile = "J-$Month-xx.pdf";
>        }
>

What about this:

$files = glob("J-$Month-*.pdf");

Then use $files[0] (or do they have to checked in order?)




More information about the UPHPU mailing list