PHP Language Basics Learning Note _php Tutorial

Source: Internet
Author: User
Spent one hours to review for many years did not touch the Php,mark, sophomore time to learn.

1. Code Embedded Inside

2. Output function echo, equivalent to JS in the document.write

3. You can use single quotation marks when printing double quotation marks or single quotation marks when printing double quotation marks.

Echo ' She said, ' How is it? ';

echo "She said, ' How is it? '";

4. The \,echo ' I \ ' m just Ducky can be used in the same quotation marks or in the printing of symbols that need to be escaped. echo "She said,\" How is you?\ "";

5. It is recommended to use shell style, #this is a comment

6. Variable with C, preceded by $.

Echo $money;

echo "Hello, $money";

7. Connection string $aa = "SDFs"; $bb = "Fsdfs"; $CC = $aa. $bb;

$CC = $cc. " Fsdfs ";

8. With regard to digital

$n = 2.13;

$n = round ($n); 3 rounding

$n = 3.13141;

$n = Round ($n, 3); 3.131 rounding of reserved digits

$n = Number_format ($n); Add delimiter

$n = Number_format ($n, 4);//Set the number of bits to add a delimiter

9. Constants

Define (' NAME ', ' VALUE ');

Echo NAME;

10.get for initiating data requests, post users send data one-way

11.$_request is a hyper-global variable, set of $_post and $_get

The 12.isset () function is used to determine whether a variable has a value

The 13.empty () function is used to determine whether a variable is a null value

14. Verify that the Is_numeric function is used for numeric characters

15. Arrays

$band [] = "SDFs";

$band [] = "SDFs";

$ band[] = "Huhu";

$state = Array (key1 = Value1,key2 = value2 ...);

The key value corresponds to echo $state [Key1];

foreach ($array as $key = = $value) {

}

Two-dimensional arrays

$array 2 = (key1=>array1,.......);

16. Sorting

Sort by value, resetting the health value relationship

Asort Sort by value, maintaining key-value relationships

Ksort Key Sorting

Rsort,arsort,krsort Reverse Sort

17. Circular Judgment slightly

18. Include Files

Include (URL);

require (URL); Can contain multiple

include_once (URL);

require (URL); Can only contain one time

19. Working with HTML forms

if ($isset ($_post[' submitted ')) {

}

else{

}

$page _title Setting title

21. Set Sticky forms

22. Function Reference JS function

Note You can return an array

For example, return array ($avariable 1, $avariable 2);

Default parameters can be set

function greet ($name, $msg = "Hello") {

}

23. To make a variable inside a function available for external use, the global

function xxx () {

Global $FSDF;

}

http://www.bkjia.com/PHPjc/477277.html www.bkjia.com true http://www.bkjia.com/PHPjc/477277.html techarticle spent one hours to review for many years did not touch the Php,mark, sophomore time to learn. 1. Code embedded in PHP? 2. Output function echo, equivalent to JS in the document.write 3.

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