Is there a way to output PHP code as plain text? I have PHP code stored in my mysqli database, I want to fetch the PHP code and display it in a div. I don 't want the PHP code to be executed. Or is there a way to use file_put_contents() to fill a file with the PHP code? Again; I don 't want the PHP code to be executed. I either want the PHP code to be displayed as plain text or to be put in a file as plain text.
For example I have this code stored in my database:
<DOCTYPE>
<html>
<head>
<title>Test</title>
</head>
<body>
<?php
$array = array('test1', 'test2');
foreach($array as $val)
print($val);
print('works!');
?>
</body>
</html>
But when I print this code the entire PHP code won't be visible.
Or is there a way to put that PHP code from my database into a file using file_put_contents