RE: [PHP] Getting part of a string

From: Date: Fri, 27 Sep 2002 16:20:04 +0000
Subject: RE: [PHP] Getting part of a string
Groups: php.general 
Request: Send a blank email to php-general+get-117870@lists.php.net to get a copy of this message
-----Original Message----- From: ed@home.homes2see.com To: php-general@lists.php.net 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 --------------------------------------------------------- Just explode the string with / as the delimiter, and then grab the [2] element, for instance: $dirnames = explode('/', $a); echo $dirnames[2]; Cheers! Mike

« previous php.general (#117870) next »