Given that I have a url https://website.com/test/demo/success.php?token=-abc123-, I want to get the value abc123. Somehow I find two blank lines on preg_match.
$url = 'https://website.com/test/demo/success.php?token=-abc123-';
preg_match('-(.*?)-', $url, $match);
var_dump($match);
Output: array(2) { [0]=> string(0) "" [1]=> string(0) "" }
What am I doing wrong here?
source
share