Results 1 to 3 of 3

Thread: How To Use Echo statement in PHP

  1. #1
    Join Date
    Feb 2009
    Posts
    72

    How To Use Echo statement in PHP

    Hello,

    please some one help. I want to pass the variables neatly in the below coloured boxes... how do I execute such using echo function.This is I am asking for to see how exactly we could use Echo statement in the PHP...

  2. #2
    Join Date
    Dec 2008
    Posts
    183

    Re: How To Use Echo statement in PHP

    The echo () function is used to output the given argument. It can output all types of data and multiple outputs can be made with only one echo () command.

    Examples:

    PHP Code:
        <?php
        
    Echo "Hello";
        
    //Outputs a string
        
    Echo $variable;
        
    //Outputs a variable
        
    Echo "Multiple things " $on " one line";
        
    //Outputs a string, then a variable, then a string. All are separate ?>

  3. #3
    Join Date
    Oct 2008
    Posts
    167

    Re: How To Use Echo statement in PHP

    echo() is not actually a function (it is a language construct), so you are not required to use parentheses with it. echo() (unlike some other language constructs) does not behave like a function, so it cannot always be used in the context of a function. Additionally, if you want to pass more than one parameter to echo(), the parameters must not be enclosed within parentheses.

    echo() also has a shortcut syntax, where you can immediately follow the opening tag with an equals sign. This short syntax only works with the short_open_tag configuration setting enabled.

    PHP Code:
    <?php
    echo "Hello World";

    echo 
    "This spans
    multiple lines. The newlines will be
    output as well"
    ;

    echo 
    "This spans\nmultiple lines. The newlines will be\noutput as well.";

    echo 
    "Escaping characters is done \"Like this\".";
    ?>

Similar Threads

  1. Need to know about Kyocera Echo
    By Corwinn in forum Portable Devices
    Replies: 4
    Last Post: 15-02-2011, 04:35 PM
  2. Replies: 3
    Last Post: 05-09-2009, 01:41 PM
  3. Information on php echo
    By Rebeccak in forum Software Development
    Replies: 3
    Last Post: 07-07-2009, 09:56 AM
  4. Replies: 4
    Last Post: 25-02-2009, 07:52 PM
  5. Set colors in echo
    By revolucioncg in forum Software Development
    Replies: 3
    Last Post: 14-02-2009, 08:53 PM

Posting Permissions

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