【day08】PHP

A function.
 1. Function: the code segments to complete certain functions of the package, can be reused.
 2. Classification function:
   (1) the system function
   (2) Custom Function
 3. custom function
   (1) format
   function name of the function ([Parameter [= value] [parameter [, ...]]]) {
     .. .
   }
   (2) named after a predetermined function
     a. function names start with a letter or underscore and contain letters, numbers, underscores.
     . B prohibit function name contains special symbols
     c unambiguous function name as possible.
     E camelCased try to use the function name.
     F function names beginning with a verb as possible.
               For example: getInfo, isInfo inInfo setInfo
     . G function names are case insensitive
        Description: variable function names, constants, classes, methods, properties, files, folders, pictures, and so the character path
   
   (3) function call
    [$ variable name =] function name ([parameter [, parameter [, ...]]])
   
   ( 4) function principle: do not call function is not performed when the function will exist when defining the function in memory, the location will find the name of the function in memory when the function is called and executed, and finally complete execution of the function will transfer control back to the body calls on the function of the position
   
   (5) parameter
     a parameter: the programmer with the function of communication media
     b. at least 0 parameters (0, 1, ... multiple)
     C. parameter can be any data type
     d. not mandatory parameter value of the parameter, the parameter value has an optional parameter a mandatory parameter in certain optional parameters front
   
   (6) the return value of
   function function name ([parameter [= value] [parameter [, ...]]]) {
     ...
     [return value]
   }
      Description:
     . a return value: the result of the function execution
     b return values can only be zero or 1
     c. After returning value can be any type of data
     D. the return value of the functional end of the function performed, and transfers control to the calling function the position of the
     E. return values and parameters are not necessarily Contact
   (7) variable function: function name (string) assigned to the variable, and the use of parentheses with variables that PHP parsing engine can normally function
     
   (8) recursion: A function is called, the function A calls function B , and the function a and function B are the same function (function calls itself)

 

Guess you like

Origin www.cnblogs.com/tommymarc/p/11627319.html