On Sat, Jan 31, 2009 at 9:33 AM, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx> wrote: > On Sat, 2009-01-31 at 08:38 -0500, Eric Butera wrote: >> On Sat, Jan 31, 2009 at 7:32 AM, Ashley Sheridan >> <ash@xxxxxxxxxxxxxxxxxxxx> wrote: >> > On Fri, 2009-01-30 at 21:33 -0500, Eric Butera wrote: >> >> On Fri, Jan 30, 2009 at 9:28 PM, Ron Piggott <ron.php@xxxxxxxxxxxxxxxxxx> wrote: >> >> > How do I determine the value of tx from this string? >> >> > >> >> > >> >> > page/words_from_the_well_checkout/?tx=8UM53005HH344951T&st=Completed&amt=0.01 >> >> > >> >> > My desired answer is: 8UM53005HH344951T >> >> > >> >> > I am trying to capture the serial number which follows tx= and ends >> >> > immediately before the & >> >> > >> >> > Ron >> >> > >> >> >> >> http://us.php.net/parse_str >> >> >> >> -- >> >> http://www.voom.me | EFnet: #voom >> >> >> > Go regular expressions... >> > >> > /tx=([^\&]+)/ >> > >> > then do a preg_match with the string using the $matches array argument. >> > $matches[1] should be your value. >> > >> > >> > Ash >> > www.ashleysheridan.co.uk >> > >> > >> >> There really isn't a need to even try to build something like that >> when something already exists exactly for the purpose. It's well >> documented too. Plus after this part works, there's probably a good >> chance we'd be looking for that second variable. =) >> >> -- >> http://www.voom.me | EFnet: #voom >> > But isn't what you suggest to use only available in PHP5? When possible, > I try to build for PHP4, as my own hosting, and others I've seen only > support 4, and the old answer of "find a better hosting" is not always a > good solution. > > Besides, if you need the second part of the URL, just adapt the regular > expression a bit. I don't why people seem so afraid of them to be > honest. > > > Ash > www.ashleysheridan.co.uk > > parse_str (PHP 4, PHP 5) parse_str — Parses the string into variables -- http://www.voom.me | EFnet: #voom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php