PHP_01 PHP overview, Data, syntax, php_01php overview syntax

Source: Internet
Author: User
Tags parse error

PHP_01 PHP overview, Data, syntax, php_01php overview syntax

1. Definition: PHP Hypertext Preprocessor, Hypertext Preprocessor, and server-side scripting language;
2. Environment: WAMP: Window + Apache + PHP + MySQL;
LAMP: Linux + Apache + PHP + MySQL;
Web server access: http: // localhost: 80 or http: // 127.0.0.1: 80
3. Syntax:
Common Errors: Parse error (parsing error) and syntax error (syntax error );
Eight data types: ① integer (int/integer), range:-2.1 billion ~ 2.1 billion, 0 ~ 4.2 billion; ② floating point type (float/double/real); ③ string (string), single-cited non-resolution variables, double-cited resolution; ④ boolean (bool/boolean), true/false; ⑤ array (array); ⑥ object; 7resource; null (NULL/null); declare and assign a value to NULL. The variable value is not declared as null, the value of the unset () deregister variable is NULL;
Constant: define (name, value); const NAME = VALUE; constant name cannot contain $;
System constant: PHP_VERSION: php version; PHP_ OS: runtime environment;
Magic constant: _ LINE _: Get the current row number; _ FILE _: Get the absolute path of the FILE including the FILE name; _ DIR _: Get the absolute path of the current FILE does not contain the FILE name;
Pre-Defined variables: $ _ GET: Form sending, address bar parameter passing, hyperlink parameter passing; $ _ POST: form receiving; $ _ REQUEST = $ _ GET + $ _ POST + $ _ REQUEST;
4. Data type conversion:
Implicit conversion: ① convert to a value: true-> 1, '31king'-> 31, 'true'-> 0; ② convert to a string: true-> string 1, false-empty string, numeric-numeric string; ③ convert to boolean false: 0/0. 0/'0'/null/empty array;
Forced conversion: ① parentheses (int), (string), (bool), (array )...; ② Function form: intval (), floatval (), strval (), boolval (); the variable itself is not affected;
Permanent conversion: The variable type will be changed; settype ($ val, $ type); set the variable type gettype ($ val); return the variable type
5. Commonly used:
Echo: the output string separated by commas;
Var_dump ($ var,...): prints variable details;
Unset ($ var,...): destroys a variable;
Header ('content-type: text/html; charset = utl-8 '): tells the browser encoding method;

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.