Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2016
    Posts
    23
    Thanks
    14
    Thanked 0 Times in 0 Posts

    echo the value of a constant in a table

    Hi guys!
    i just started learning php and there is something I am very confused about: I have a constant whose value I would like to print in an html table but it does not work but I do not understand why.

    PHP Code:
    define("SAVIOR""JESUS CHRIST")
    $row "
    <table>
    <tr>
    <td>'SAVIOR'</td>
    <td>SAVIOR</td>

    </tr>
    </table>
    "
    ;
    echo 
    $row;[/INDENT
    Could someone please explain to me why it does not print the value of the constant that is JESUS CHRIST?

  2. #2
    Regular Coder Synaptic's Avatar
    Join Date
    Apr 2015
    Location
    Las Vegas
    Posts
    241
    Thanks
    3
    Thanked 35 Times in 35 Posts
    You're passing "SAVIOR" as a string. Also, this should be in the general PHP forum not the snippets.

    PHP Code:
    <?php

    define
    ("SAVIOR""JESUS CHRIST");
    $row "
    <table>
    <tr>
    <td>"
    .SAVIOR."</td>

    </tr>
    </table>
    "
    ;
    echo 
    $row;


    ?>


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •