Common php functions, examples of php user-defined functions, callback functions, variable functions, and recursive functions, as well as the usage of php global variables, local variables, and static functions. Php function language structure: if () for () while () switch () echo () print () array () list () foreach () isset () unset () empty () exit () die () include () require () Custom functions: Function fun (){}1. call function fun () ";}Echo" ";}jiutb (9," # cccccc "); jiutb (10," red ");?>Default parameters: Function jiutb ($ num = 9, $ color = "black "){}2. variable parameters 3. the sum of infinitely multiple parameters: 4. variable functions Function fun () {}$ a = "fun"; $ a (2, 3, 4, 5 );Variable scope: 1. variables outside the global variable function 2. variables in the local variable function After the glocal keyword is modified, you can change the local variable to a global variable. Reference parameter: 1. the Function Points internally and externally to the same address. Callback function: a type of parameter. if a function parameter is the name of another function, this parameter is called a callback function. Static variables call the same function multiple times. static variables can be tracked continuously. // When calling a program, count the number of calls of this function. ";}Show (); show () ;?>Static variable method: ";}Show (); show ();?>File inclusion: 1. include () contains errors. the script continues to run. 2. require () if an error exists, the script is terminated immediately. Recursive function: This function is called in the function. 1. sum: // Recursive function $ num = 100; for ($ I = 1; $ I <= $ num; $ I ++) {$ sum + = $ I ;} echo $ sum;Function call sequence Show (); function show () {} show ();6. php execution sequence 1. loading page 2. syntax check (1. syntax check 2. loading function) 3. execute script |