Can't seem to figure this one out. Just trying to preg match for a specific variable name in a link URL:
<a href="http://something.com?variable=name">GenericLink</a>
How do I get the variable=name out of this?
Thanks!
Can't seem to figure this one out. Just trying to preg match for a specific variable name in a link URL:
<a href="http://something.com?variable=name">GenericLink</a>
How do I get the variable=name out of this?
Thanks!
Extract the whole url and then use parse_url();
$str = '<a href="http://something.com?variable=name">GenericLink</a>';
preg_match('/href="([^"]*)/i',$str,$matches);
var_dump(parse_url($matches[1]));