Adam, > Hi, I use a piece of proprietary software at work that uses weird session > ID strings in the URL. A sample URL looks like: > > http://zed2.mdah.state.ms.us/F/CC8V7H1JF4LNBVP5KARL4KGE8AHIKP1I72JSBG6AYQSMK8YF4Y-01471?func=find-b-0 > > The weird session ID string changes each time you login. Anyway, how can > I strip out all of the text between the last / and the ? and insert it > into another variable? So in this case, the end result would be a > variable containing: > > CC8V7H1JF4LNBVP5KARL4KGE8AHIKP1I72JSBG6AYQSMK8YF4Y-01471 You can use the parse_url() function to get just the path, and then use strrpos() to find the last "/" character. Finally, use substr() to extract the piece that you wanted. Example: $url_array = parse_url('http://zed2.mdah.state.ms.us/F/CC8V7H1JF4LNBVP5KARL4KGE8AHIKP1I72JSBG6AYQSMK8YF4Y-01471?func=find-b-0'); $slash_pos = strrpos($url_array['path'],'/'); $session_ID = substr($url_array['path'],$slash_pos+1); /sylikc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php