9
<?php echo htmlentities('<?php echo \'aoeu\'; ?>'); ?>
<?php echo '<?php echo \'aoeu\'; ?>'; ?>
If you don't escape the '<' and '>' they will be printed as html tags.
This cannot be done directly in the way that you posted.
PHP is a server side scripting language as I am sure you know. This means it is executed before the page is shown to the user.
In effect, your code is writing the text to the browser, but not to the server. The only way to execute php code generated by other php code would be to write the new code to a file, then run the file once the page loads.
Example 1
<?php echo '<pre>', highlight_string('<?php
include($_SERVER["DOCUMENT_ROOT"] . "/myclass/myform.php");
?>', true), '</pre>'; ?>
Example 2
See php manual highlight-string