I'm trying to match the numbers inside ('')
$linkvar ="<a onclick="javascript:open('597967');" class="links">more</a>"
preg_match("^[0-9]$",$linkvar,$result);
I'm trying to match the numbers inside ('')
$linkvar ="<a onclick="javascript:open('597967');" class="links">more</a>"
preg_match("^[0-9]$",$linkvar,$result);
Your regex will only match if the string is exactly one digit. To match only the digits inside the quotes, use:
preg_match("/'(\d+)'/", $linkvar, $result);
var_dump($result[1]);