Jump to content

Variable URL Regex


e1seix

Recommended Posts

Regex should not be needed for this, given that you are asking what I think you are you should be able to use $_GET:

 

$id = isset($_GET['id'])?$_GET['id']:null;
$increment = isset($_GET['increment'])?$_GET['increment']:null;

 

If you have it inside of a string I would use parse_url:

$text = "www.mysite.com/?id=xyz&increment=01";
$queryString = parse_url($text, PHP_URL_QUERY);
list($id, $increment) = explode("&", $queryString);

 

Not sure which you were after, but there it is.

Link to comment
https://forums.phpfreaks.com/topic/187299-variable-url-regex/#findComment-989089
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.