--- In [email protected], "lilmouseman" <[EMAIL PROTECTED]> wrote: > > --- In [email protected], "Phill Sparks" <sparks.phill@> wrote: > > > > On Wed, May 7, 2008 at 11:17 AM, Mladen Milankovic <mmlado@> wrote: > > > On 5/6/08, lilmouseman <lilmouseman@> wrote: > > >> > > >> Hi Everyone. First time poster. > > >> > > >> My question is about extracting part of a path from the right. > > >> > > >> e.g. folder/images/testimage.jpg > > >> > > >> how do I get everything from the right all the way up to the > first "/" > > >> > > >> Thank you in advance. > > >> > > > > > > Hi and welcome. > > > Try something like this: > > > $path = 'folder/images/testimage.jpg'; > > > substr($path, strpos($path, '/')); > > > > > > This will give you: /images/testimage.jpg > > > > > > If you don't need the first / : > > > substr($path, strpos($path, '/')+1); > > > This will give: images/testimage.jpg > > > > > > regards > > > mmlado > > > > > > > I thought that was what he wanted too but as William pointed out it > > may not be... Using the above method you can use the strrpos instead > > of strpos (reverse search). Or you coulud use the basename function > > provided by php. > > > > Phill > > > > References: > > http://php.net/strrpos > > http://php.net/strpos > > http://php.net/basename > > > ----------------------------- > > Thanks you everyone for the help you have given me, i now understand > strings a lot better. > > The most desired solution was "basename". Worked like a charm. > > Thank you again, looking forward to participating more. >
------------------------------------------ try using preg_match() function
