Re: Getting part of a string

From: Date: Sat, 28 Sep 2002 00:37:48 +0000
Subject: Re: Getting part of a string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-117906@lists.php.net to get a copy of this message
Assuming that it will always be in this format (/something/what you want/...), explode() the string by '/' into an array, and get the right element back. <? $a = /realtor/Remax/Ed/files/ $aa = explode('/', $a); echo $aa[2]; ?> Enjoy Justin French on 28/09/02 1:23 AM, ed@home.homes2see.com (ed@home.homes2see.com) wrote: > > I've got a situation where I need to pull a string from a variable but I > can't seem to get it figured out. > > I.e. > > value of $a = /realtor/Remax/Ed/files/ > > I need to get the string between the second and third / (slash) > > What I need: Remax > > Thanks, > > Ed > >

« previous php.general (#117906) next »