1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to display PHP code

Discussion in 'PHP' started by aaron_nimocks, Oct 18, 2006.

  1. #1
    Im writing a sample php code and I want to display it on the webpage. But the damn thing keeps interpetting it instead of just displaying it.

    Is there some special character I need to put before all my php code that I want displayed versus interpetted?
     
    aaron_nimocks, Oct 18, 2006 IP
  2. PwrUps

    PwrUps Peon

    Messages:
    377
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Change < to &lt; and > to &gt; in the html/php file... Not 100% sure if this works, but I think it does cause that's how you also display html code.
     
    PwrUps, Oct 18, 2006 IP
    aaron_nimocks likes this.
  3. aaron_nimocks

    aaron_nimocks Im kind of a big deal Staff

    Messages:
    5,563
    Likes Received:
    627
    Best Answers:
    0
    Trophy Points:
    420
    #3
    Worked!

    You the man. :)
     
    aaron_nimocks, Oct 18, 2006 IP
  4. georgiecasey

    georgiecasey Member

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #4
    georgiecasey, Oct 18, 2006 IP
  5. PwrUps

    PwrUps Peon

    Messages:
    377
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    PwrUps, Oct 18, 2006 IP
  6. Fl1p

    Fl1p Active Member

    Messages:
    511
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #6
    Fl1p, Oct 18, 2006 IP
  7. streety

    streety Peon

    Messages:
    321
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #7
    If you want to get all fancy and display code on your site as it shows up here, i.e.

    
    <?php
    
    echo "A little sample php code echo.";
    
    ?>
    PHP:
    then you can also look at Geshi and the PEAR Text_Highlighter class. As well as displaying php code you can display a whole host of other languages.
     
    streety, Oct 19, 2006 IP