What function in PHP can be used to escape special characters in a textarea to prevent code execution?

To prevent code execution and potential security vulnerabilities, you can use the `htmlspecialchars()` function in PHP to escape special characters in a textarea. This function will convert special characters like `<`, `>`, `"`, `'`, and `&` into their respective HTML entities, preventing them from being interpreted as code by the browser.

// Escape special characters in textarea input
$textarea_input = htmlspecialchars($_POST[&#039;textarea_input&#039;]);