So, the trailing part of the string would be in $matches[2]? Peter West "Where the body is, there the eagles will be gathered together." On 15 Nov 2014, at 10:09 pm, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx> wrote: > > > On 15 November 2014 04:32:51 GMT+00:00, Jim Giner <jim.giner@xxxxxxxxxxxxxxxxxx> wrote: >> On 11/14/2014 10:34 PM, Ron Piggott wrote: >>> >>> Is there a way (similar to in_array) to match a partial string? >>> >>> Haystack: >>> $_SERVER['REQUEST_URI'] >>> >>> Needles: >>> /prayers-for-today/% >>> /one-year-Bible-reading-guide/% >>> /past-issues/% >>> >>> where % matches the dynamic remainder of the string >>> >>> Thank you. >> Look up the stripos function > > I would probably do something like this: > > $pattern = '/\/(prayers-for-today|one-year-Bible-reading-guide|past-issues)\/(.+)/'; > > preg_match($pattern, $_SERVER['REQUEST_URI'], $matches); > > $matches will have all your last part in as the second index. > > Thanks, > Ash > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php