PHP echo Function Detailed description

Source: Internet
Author: User
Tags php tutorial

? PHP's
Echo's "Hello World";

echo "This crosses
MultiRow New Guild
Output and ";

echo "This span nmultiple line. Change Guild Noutput same. ”;

echo "Escape character do" like this. ”;

//You can use a variable within the Echo statement
$ Foo's = "Foobar";
$ column = "Barbaz";

echo "Rich rich"; //foo is foobar.

//You can also use arrays
Buzz = $ Array ("value" "=>" is "foo");

echo "This is ($ buzz [' value ']]!" ”; //This is foo!

//Use single quotes to print variable names instead of values
Echo ' foo is $ Foo '; //$ foo is rich

//If you don't use any other characters, you can only echo variables
$ Foo's echo; //Foobar's
$ Foo's echo,$ bar; //Foobarbarbaz

//Some people like to pass multiple parameters echoing the concatenation.
Echo ' This ', ' string ', ' yes ', ', ', ' has multiple arguments. ', Commission on Human Rights (10);
Echo ' this '. ' String '. ' Yes '. '. and Tandem '. ' 。 "N";

echo<<< Finish
This will use the "here file" syntax to output
Dollar variable interpolation multiple lines. Attention
Here, the file terminator must appear in the
Fit is just a semicolon. There's no extra space!
Finish

//Since Echo is not like a function, the following code is not valid.
($ some_var)? Echo ' true ': echo ' false ';

//However, the following examples will work:
($ some_var)? print ' true ': printing false '; //printing is also a concept, but
//It behaves like a function, so
//It can be used in this regard.
echo$ Some_var? ' True ': ' false '; //Change the surrounding statement
? >


echo "ASD";//String
echo "ads$c";//String + variable
Echo ' ads$c ';//String asd$c $c not variable
echo "SD". " VS ";
echo "SD", "vs";
echo $a;
echo $a. $b;
echo $a, $b;
echo $a. $b $c;
echo $a, $b, $c;
echo "kaskd{$c}asd";
echo "kakskd{$arr [' Lo ']}";
echo "kakskd{$obj->a}";
echo "KASKD". $c. " KASD ";
echo "KASKD". $arr [' Lo ']. " KASD ";
echo "KASKD". $obj->a. " KASD ";
echo "KASKD". Func ($c). " KASD ";
echo "Kaksk". ($a + 1). " DKKASD ";
echo $c. " JAKSD ";
Echo $c, "JAKSD";
PHP Tutorial Multi-Line output method
Echo <<<end
This uses the ' Here Document ' syntax to output
End;
Output shorthand
<?php echo $a;? > <?= $a?>

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.