How can PHP be used to convert CKEditor output to normal HTML code?

To convert CKEditor output to normal HTML code using PHP, you can use the htmlentities() function to encode the CKEditor output and convert any special characters to HTML entities. This will ensure that the output is displayed correctly as normal HTML code.

$ckeditor_output = "<p>This is CKEditor output with special characters like & and <script>alert('hello');</script></p>";
$normal_html_code = htmlentities($ckeditor_output);
echo $normal_html_code;