PHP Basics Shorthand

Source: Internet
Author: User
Tags php basics

1. Weakly typed languages

2. Variable $x

3. Scope: Global,local,static,parameter.

Global: In the function, refer to the world variable, before you call global. All variables are stored in a named $globals[index]. Global $x = = $GLOBALS [' x ']

Static: Local variables in the function do not want to be destroyed after the execution of the function, with static. This will preserve the last value when the function is called again the next time.

4. Array: $arr =array (x,x,x,x); Var_dump () Array (' a ' = ' = ' aaa ', ' b ' = ' BBB ');

Number length count ($arr)

Iterate array for () loop PHP associative array traversal associative array: foreach ($arr as $key + = $value)

Sort: Sort ($arr) ascending, Rsort ($arr) Descending

5. Object object data types must declare class objects using the Class keyword. A class is a structure that can contain properties and methods. With $this.

6.php set constant define (name,value,true)//Case insensitive constant is global define (' GREET ', ' www.baidu.com ')

7. String concatenation '. '. strlen (str) returns the string length. Strpos (STR,SUBSTR) Find the position of the string substr in str

8. Operator% take-up

9. Super global variable $GLOBALS, $_post,$_get,$_files "

10. Loop foreach ($arr as $value) {}

11. Include ' file.php '

PHP Basics Shorthand

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.