The meaning of variables, echo, constants, data types

Source: Internet
Author: User

1. The definition of a variable: The variable name is referenced to the value of the variable   unset: equivalent to the reference is removed, and then according to the PHP garbage collection mechanism (the variable value is not referenced by any one variable), the variable is recycled. Naming conventions for    variables "This does not need to be studied. is object-oriented, the use of the small hump naming rules "" After the UTF8, the use of Chinese can also do variable names "   variables are used directly before the definition will be reported a notice" isset use "   variable name does not use the keyword   Focus:     pass by value variable is passed by value by default, but can be changed to value by reference (parameter can be set in function) "   Pass Value by reference" & Another Variable "" This symbol is changed to the value by reference, and the change to the variable is directed to the reference value (instead of duplicating it) (in the Foreach Loop, the change in the variable is caused by the setting of the value by reference. The same effect as the specified key) " unset and the case of passing values by value and by reference   2.echo is not a function (is a language structure) ', ' in the efficiency of splicing strings than '. ' Good   variable variable: $ $hello; "Use of two $ characters" "Example: $hello = ' world '; $ $hello;//variable name can be a variable!!! "" and mutable functions? The predefined variables common to the   predefined variables: The common "" PHP.ini for Get and post configuration takes effect "  takes into account the scope" Global and local Scope ", which is different from the scope chain of JS. The mechanism of the scope chain to implement global and local variables "  3. Constant constants Use uppercase" to verify that the constants are defined by using define, if none are defined, "predefined constants are primarily delimiters, line breaks, etc. compatibility between different systems" use these Predefined constants "   Magic constants: "Auxiliary __line__ in Programming" "Get some Current parameters"    "Focus" 4. Data type PHP data type: "PHP does not need to declare the data type, the context of the current program to determine the" 4 Standard types: integer, floating-point, Boolean, String 2 conforming types: arrays, objects 2 special types: Resources and null  use Var_dump to get current data type   integer: Maximum and placeholder "PHP_INT_MAX; Php_int_size "Binary conversion case" calculation of remainder "PHP has a function to go directly into the system."An understanding of the different mechanism names" integer overflow in PHP if the maximum integer is exceeded, PHP converts the integer type to float "  floating point:" decimal type: Need to have a sense of precision "" Do not judge the floating-point data identically: it can cause problems!!! The problem with floating point is imprecise. will be the problem when judging the floating-point number "" In the program do not compare two floating-point numbers are equal to the logical comparison (the way to compare accuracy, or multiply a value into an integer) "  Boolean:true/false  string: Parsing of variables in strings" Whether the variable can be parsed is related to the symbol defined by the variable: echo "I like ' $a '";//In this case, the $a can be parsed as a normal echo ' I like ' $a ';//In this case, the $a can not be parsed echo "I am {$a}bc";// This scenario will parse a $ A parsed string with the following part of the "escape" of the "  Character and encoding problem"   use the delimiter to enlarge the output of the string "actually not used"     An array of two composite types: a collection of arrays consisting of key-value pairs "for ease of addressing" if you do not specify an array's subscript and assign a value directly to a group, the newly added key is for the maximum key value plus one. Arr[0=> ' 1 ',100=> ' 2 '];arr[]=3;print_r ($arr); The string does the array to get the letters at the specified position. $str = ' php '; echo $str [0]; Chinese question    object: is also a data structure "a combination of situations" objects are the key to isolating data and modules    Resources: Resource in PHP programming, it is sometimes necessary to manipulate some resources that are not part of PHP itself. "The data structure used by PHP is the resource" "Database, Redis, etc."   null: Indicates that a variable has no value. "Assignment null, undefined, unset variable"     pseudo type? The type of data that needs to be described in the program. "Only used to describe the use, actually not the language itself" number numeric type mixed mixed type callback callback "using a function pointer as a parameter pointer is called" void "function return value is useless"                   problem: A unified summary of bits and bytes an understanding of connection pooling for HTTP connections and PHP connection databases

The meaning of a variable, echo, constant, data type

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.