How effective are Captchas in preventing spam in PHP forums, and what are the limitations of using them?

Captchas are effective in preventing spam in PHP forums by requiring users to prove they are human before submitting a form. However, they are not foolproof as some automated bots can still bypass them. Additionally, Captchas can sometimes be frustrating for legitimate users to solve, leading to a poor user experience.

// Example of adding a Captcha to a PHP form
<form action="submit.php" method="post">
    <label for="captcha">Please solve the following: <?php echo rand(1, 10) . ' + ' . rand(1, 10) . ' = '; ?></label>
    <input type="text" id="captcha" name="captcha">
    <input type="submit" value="Submit">
</form>