How to echo the '<?php' in HTML without starting a php section -


the title descripe it:

how echo <?php open tag, without starting <?php section. tried this:

$string = str_replace("<?php","<?php",$string); 

i hope can me! :)

kind regards, leo

php not recursively embeddable. following

<?php  echo "<?php echo 'hi mom!' ?>"; 

will output literal characters <, ?, p etc... "internal" echo not executed, because it's not php code - it's characters in string.

note if you're outputting text html context (e.g. web browser), <?php tag mis-interpreted invalid/illegal html tag, , skipped browser. in case, have do

echo "&lt;?php echo 'hi mom!' ?&gt;" 

remember - you're not outputting php code, you're outputting text, , if it's going web page, text has valid html.


Comments