如何打印php作为HTML文本[关闭]

please, how to print php as html text ?

for example:

i have this php line

if(defined('LOAD_VARS') AND LOAD_VARS === TRUE)

i want to print it as html text

so output will be

if(defined('LOAD_VARS') AND LOAD_VARS === TRUE)

i have tried this

<textarea style="width:600px; height:30px;">if(defined('LOAD_VARS') AND LOAD_VARS === TRUE)</textarea>

but it doesn't work and show error

how i can do that please ?

how

Your question isn't very clear, but here goes:

Close the PHP tag before outputting anything, or simply use print() or echo.

Example 1:

<?php
print('if(defined(\'LOAD_VARS\') AND LOAD_VARS === TRUE)');
?>

Example 2

<?php
// Your code that you want to be run.
?>

<pre>if(defined('LOAD_VARS') AND LOAD_VARS === TRUE)</pre>

Have a look at highlight_string

$source = "if(defined('LOAD_VARS') AND LOAD_VARS === TRUE)";
echo highlight_string($source, true);