PHP syntax basics required by the front-end, front-end php syntax _ PHP Tutorial

Source: Internet
Author: User
The front-end must learn the PHP syntax basics and the front-end php syntax. The front-end must learn the basics of PHP syntax. if the front-end php syntax is written in front, PHP is a powerful server-side scripting language for creating dynamic interactive sites. PHP can contain text, HTML, and PHP syntax basics required by the front-end.

Preface

PHP is a powerful server-side scripting language for creating dynamic and interactive sites. PHP can contain text, HTML, CSS, and PHP code. it is executed on the server and the result is returned to the browser in plain text.

Code ID

PHP code with <? Php, starting with?> And can be placed anywhere in the document.

<?php//?>

The PHP statement ends with a semicolon (;). The close tag of the PHP code block automatically indicates a semicolon.

<?phpecho "Hello World!";?>

Note

PHP supports three annotations, including two single-line annotations and one multi-line annotation.

<? Php // This is a single line comment # This is also a single line comment/* This is a multi-line comment block it spans multiple lines */?>

Output

In PHP, there are two basic output methods: echo and print

Print can only output one string, and always returns 1

Echo can output more than one string. echo is faster than print because it does not return any value.

Note: echo and print are both Language Structures. echo or echo () and print or print () can be used with or without parentheses (), there must be at least one space between the echo or print keyword and the string.

<? Phpecho "PHP is fun! "; Echo" Hello world!
"; Echo" I'm about to learn PHP!
"; Echo" This "," string "," was "," made "," with multiple parameters. ";?> <? Phpprint "PHP is fun! "; Print" Hello world!
"; Print" I'm about to learn PHP!
"; // This row has an error because print can only output one string: print" This "," string "," was "," made "," with multiple parameters. ";?>

Calculation expression

Unlike HTML and CSS, you can write computation expressions in PHP.

<?php//36echo 12*3;?>

Case sensitivity

In PHP, all user-defined functions, classes, and keywords are case-insensitive, but all variables are case-sensitive.

<?php//Hello World!ECHO "Hello World!
";//Hello World!echo "Hello World!
";//Hello World!EcHo "Hello World!
";?>

A friendly reminder to everyone: "." represents a string connection. in other programming languages, "+" is generally used.

<?php$color="red";//My car is redecho "My car is " . $color . "
";//My house is echo "My house is " . $COLOR . "
";//My boat isecho "My boat is " . $coLOR . "
";?>

The above content is the basic PHP syntax that must be learned by the front-end editor. I hope it will be helpful to you and thank you for your support for the help House website, I wish you a happy new year .!

Articles you may be interested in:
  • PHP basic syntax format
  • Check whether the PHP file has a syntax error in PHP.
  • Definition and syntax of removing null characters in php trim
  • Configure php web page to display various syntax errors
  • Summary of the basic syntax of php regular expressions
  • Vim plug-in for PHP syntax automatic check
  • PHP syntax summary basics and variables

PHP is a powerful server-side scripting language for creating dynamic and interactive websites. PHP can contain text, HTML ,...

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.