What is the correct way to display text within a Tiny MCE Editor using PHP?

When displaying text within a Tiny MCE Editor using PHP, it's important to make sure that the text is properly encoded to prevent any HTML or JavaScript injection attacks. This can be done by using the htmlentities function in PHP to convert special characters to their HTML entities.

// Retrieve text from database
$text = $row['text'];

// Display text within Tiny MCE Editor
echo '<textarea>' . htmlentities($text) . '</textarea>';