non credo esista una funzione del genere, ma puoi fare una cosa del genere:
ciaocodice:$aperte = 0; $chiuse = 0; $stringa = "prova(parentesi)"; for($i = 0; $i < strlen($stringa); $i++) { if($stringa{$i} == "(") { $aperte ++; } if($stringa{$i} == ")") { $chiuse ++; } } if($aperte == $chiuse) { echo "OK"; } else { echo "KO"; }