Putting all of this together, it is clear from the example that InnateDev intends to test against positive numeric values inside the parentheses. In my opinion, the safest way to do this would be:
$testString = "<a href=\"http://www.link-url.ext\">My Link</a> (55)";
$matches = array();
/* Assuming here that they never contain negative values e.g. (-55) */
preg_match('/\((\d*?)\)/s', $testString, $matches);
$hasComments = false;
if (count($matches) >= 1) // * Note A
{
$hasComments = $matches[1] > 0;
}
if ($hasComments)
{
// link
}
else
{
// no link
}
Note A: Maybe this is redundant, in which case you're free to ignore it - this can also go as a comment to Mark Baker's answer (sorry, don't have those 50 rep yet :( ) - if you're working in an environment where error_reporting includes E_NOTICE and if the tested string comes from an untrusted source then $matches[1]
will raise a notice when no parantheses are present. Just wanted to point this one out.