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

php coding question

Discussion in 'Off Topic' started by Chimpie, Nov 24, 2014.

  1. Chimpie

    Chimpie Well-Known Member

    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?
  2. Chimpie

    Chimpie Well-Known Member

    <pre> doesn't work
  3. turtile

    turtile Well-Known Member

    I don't know PHP but couldn't you just use a string (echo).
  4. Chimpie

    Chimpie Well-Known Member

    I got it solved.
    Replace < with &lt; and replace > with &gt;
  5. EQnoble

    EQnoble Well-Known Member

    If you just echo a string containing html it will output and be recognized as html.

    You just need to encode the html entities, here is an example of how to do that
    $exampleCode '<div>example html here</div>';
    'To code this, it should look like ...' htmlentities($exampleCode);
    Chimpie and Jay like this.

Share This Page