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 echo this out...

Discussion in 'PHP' started by webgames247, Mar 3, 2015.

  1. #1
    Hi all,

    what is the correct way to echo this php out? i am newbie in php :)

    $description = "<?php echo $Description; ?>";

    Thanks advance
     
    webgames247, Mar 3, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
     
    echo $description;
    
    PHP:
    Or, if you haven't assigned $description yet, you can also do
     
    echo $description = 'some value';
    
    PHP:
    This assigns and echoes the variable
     
    PoPSiCLe, Mar 3, 2015 IP
    webgames247 likes this.
  3. webgames247

    webgames247 Well-Known Member

    Messages:
    412
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    128
    #3
    description is already assigns and i want to echo my description from database to my header.
    sitedescription = "<?php echo $Description; ?>"; so i need the escho where are the red highlight.



    Thanks
     
    webgames247, Mar 3, 2015 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    You don't echo within a variable-assignment. You echo the variable (ie, the first variable), like I showed you in my previous seccond example.
     
    PoPSiCLe, Mar 4, 2015 IP