[PHP] Beginner Notes

Source: Internet
Author: User
Tags define function
The 1.PHP data type is a dynamic type, which determines the type automatically by the value it stores, the type can be transformed, and the variable type is not specified when declaring a variable.

2.define function definition constant variable all uppercase (convention)

3. Use constant variable constants the front of the variable does not require a drug plus $ symbol.

4. Variable types can be tested and reset

5.switch can support int, float, string. (A wide range than A/C + +)

6. Whitespace characters in a string variable assignment value (a newline space tab) are saved in a WYSIWYG way, such as:

$var = "This sentence have

Lines. "

Here, the string variable $var contains a newline character, which is not the same as C + +. In C + +, the value of the string variable to

A newline must use the escape symbol \ n, and the line break on the writing must be added ' \ ' at the end of each line, but not as seen

The way to store

7.bool define (String $name, mixed $value [, bool $case _insensitive = false] Fixed

You can use either a variable or another constant value or a literal.

8. It is best not to enclose the variable in double quotation marks when the variable is connected to the string, which reduces complexity, maintains consistency, and ensures correctness.

9.when a dot is used at the beginning or end of a character class, it loses it special wildcard meaning and becomes just a literal dot.

10.php built-in functions are available in all script, and custom functions are only valid for files defined by a function, to use a custom function in multiple script, you should

Put it in a file and then use require or include.

11. When you need to use the variables contained in the file, just declare the corresponding variables before you include the declaration. This is because the included effect is equivalent to removing the PHP tag at the beginning and end of the included file, and then all the content

Write to the include file.

12. Definitions of functions in the same file can be placed after use

  • 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.