How to check wether an URL already has a parameter inside it?

barrywasp

New Member
Using PHP I need to check wether an URL I am appending information to already has a parameter or not.So if the URL is\[code\]http://test.com/url?a=1\[/code\]I would need to add on &b=2, ie\[code\]http://test.com/url?a=1&b=2\[/code\]However if the URL was\[code\]http://test.com/url\[/code\]I would need to append\[code\]http://test.com/url?b=2\[/code\]Is it possible to check for this within PHP? In summary I need to attach the b=2 parameter using the correct separator character ("?" if there was none in the existing link or "&" if there is already a "?" in the existing link). Thanks!Greg
 
Back
Top