Basic php syntax

Source: Internet
Author: User
: This article mainly introduces the basic syntax for getting started with php. For more information about PHP tutorials, see. After I started my blog, I failed to write an article for a while. today I will introduce the basic syntax of php. In terms of syntax, php and c ++ are quite similar. well, if you don't need to talk nonsense, go directly to the code.

 It can be omitted if no other content exists after the end of the php code // the variable in php does not need to declare the Type $ num = 1; // if statement if ($ num = 1) {$ total = 1 ;}else {$ total = 0 ;}// loop structure while ($ total <10) {$ total ++ ;} // of course, the loop structure also includes for and do while // The Output Content echo $ total is demonstrated below; // echo is used to print the content, the above program outputs $ total content // The UDF addOne ($ value) {$ value ++; return $ value ;}// the function in php does not need to specify the return type, the return data type can be any or not.


I have written so much today. next time I will introduce how to use php for mysql database operations.

The above describes the basic syntax for getting started with php, including some content. if you are interested in the PHP Tutorial, please follow the PHP Chinese website (www.php1.cn) for more information )!

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.