PHP print, display, output function collection _php Tutorial

Source: Internet
Author: User
Tags php print
Echo"Hello World";

Echo"This spans
Multiple lines. The newlines would be
Output as well ";

Echo"This spansmultiple lines. The newlines would beoutput as well. ";

Echo"Escaping characters is do" like this ".";

//You can use variables inside of an echo statement
$foo= "Foobar";
$bar= "Barbaz";

Echo"Foo is$foo"; //foo is Foobar

can also use arrays
$baz= Array ("Value"="foo");

Echo" This is{$baz[value]} !"; //This is Foo!

Using single quotes would print the variable name, not the value
EchoFoo is $foo; Foo is $foo

If you aren't using any other characters, you can just echo variables
Echo$foo; //Foobar
Echo$foo,$bar; //Foobarbarbaz

Some people prefer passing multiple parameters to echo over concatenation.
Echo This, string, was, made, With multiple parameters., CHR(Ten);
Echo This. string. was. made. With concatenation.. "";

Echo <<<>
This uses the ' Here Document ' syntax to output
Multiple lines with$variableinterpolation. Note
The here document Terminator must appear on a
Line with just a semicolon. No extra whitespace!
END;

Because Echo does not behave as a function, the following code is invalid.
($some _var) ? Echotrue: Echofalse;

//However, the following examples would work:
($some _var) ? Printtrue: Printfalse; //Print is also a construct, but
It behaves like a function, so
It is used in the this context.
Echo$some _var? true: false; //Changing the statement around
?>


====================
PHP die () function<>< p=""><>

http://www.bkjia.com/PHPjc/486540.html www.bkjia.com true http://www.bkjia.com/PHPjc/486540.html techarticle ? PHP echo Hello World, echo this spans multiple lines. The newlines would be output as well; echo This spansmultiple lines. The newlines would beoutput as well. ; Echo Escaping cha ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.