Basic syntax for PHP

Source: Internet
Author: User
Tags php language

I. First PHP program

1. Write a file with the suffix named helloworld.php

2. Place the helloworld.php file in the Web server's document root directory

3. Access the helloworld.php file under Web Server management via the browser: http://localhost/helloworld.php

<?phpecho "HelloWorld";? >

4. php files can be written in HTML, CSS, JavaScript and other languages, but the PHP fragment code will be used in the PHP Application server parsing,

The parsed code is sent to the client's browser, the other front-end code is sent directly to the clients, and the client is parsed by the browser.


Two. PHP syntax

1. PHP Language Tags

1.) <?php?> --->>> recommended Use this, if the script ends after?> can not add

2.) <? ?>

3.) <?= $var?>

4.) <%%> --->>> if not, you need to change asp_tags = off in C:/windows/php.ini to on

5.) <script language= "php" > </script>


2. Notes in the program

1.)//single-line comment

2.)/* */multi-line Comment

3.) # Script Comment

4.)/** * * Documentation Comments


Related Article

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.