What are some potential pitfalls to be aware of when working with textareas in PHP?

One potential pitfall when working with textareas in PHP is not properly sanitizing user input, which can leave your application vulnerable to cross-site scripting attacks. To prevent this, always use htmlspecialchars() function to escape user input before displaying it in a textarea.

<textarea><?php echo htmlspecialchars($user_input); ?></textarea>