RE: [PHP] regular expressions help please
| From: | Ford, Mike [LSS] | Date: | Tue, 30 Apr 2002 10:36:27 +0000 |
| Subject: | RE: [PHP] regular expressions help please | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-95352@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: John Fishworld [mailto:john@webital.de]
> Sent: 30 April 2002 09:32
>
> I'm trying to find files in my array
> for example
> ="lg_imode.gif"
> and
> ="/db/imodeklein/edgar-IMODE-1-.gif"
>
> I want to differentiate between the files with slash at the
> front and ones
> without so that
> I can add a server path !
If all you want is to differentiate the ones where the first letter is a "/", why
don't you just check exactly that?
foreach ($array as $key=>$fname):
if ($fname{0} =='/'):
// begins with slash -- add server path
endif;
endforeach;
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211