• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

php coding question

Chimpie

Well-known member
#1
Let's say I'm coding a simple php page non-xenforo). As part of this page I want to write, "To code this, it should look like ..." where I would display that code. What would I wrap the code in so that it does execute?
 

EQnoble

Well-known member
#5
I don't know PHP but couldn't you just use a string (echo).
If you just echo a string containing html it will output and be recognized as html.


Let's say I'm coding a simple php page non-xenforo). As part of this page I want to write, "To code this, it should look like ..." where I would display that code. What would I wrap the code in so that it does execute?
You just need to encode the html entities, here is an example of how to do that
PHP:
$exampleCode = '<div>example html here</div>';
echo 'To code this, it should look like ...' . htmlentities($exampleCode);
the output said:
To code this, it should look like ...&lt;div&gt;example html here&lt;/div&gt;