[TOC]
## 【函數處理】相關函數
> [ 函數參考](http://php.net/manual/zh/funcref.php)
* __NAMESPACE __ ==> 當前命令空間
1. call_user_func_array( ); [# 調用回調函數,并把一個數組參數作為回調函數的參數](http://php.net/manual/zh/function.call-user-func-array.php)
2. call_user_func( ); [# 把第一個參數作為回調函數調用](http://php.net/manual/zh/function.call-user-func.php)
3. func_get_args( ); [# 函數內部獲取所有傳入的參數](http://php.net/manual/zh/function.func-get-args.php)
4. func_num_args( ); # 函數內部獲取到傳入參數的個數
5. __ FUNCTION__ # 函數名字
7. function_exists(函數名” ); [# 判斷一個函數是否已經存在](http://php.net/manual/zh/function.function-exists.php)
8. get_defined_functions( ); [# 返回所有已定義函數的數組](http://php.net/manual/zh/function.get-defined-functions.php)
9. get_included_files(); [# 打印所有包含的文件](http://php.net/manual/zh/function.get-included-files.php)
10. register_shutdown_function( ); [# 注冊一個會在php中止時執行的函數](http://php.net/manual/zh/function.register-shutdown-function.php)
* * * * *
### PHP變量作用域
1. 函數內部聲明的變量,只能在函數內部調用(局部變量)
2. 函數內部想使用全局變量 必須在函數內部引入 global $a,$b....;
3. 子函數可以使用父函數中的局部變量(使用use 關鍵字)
> `$one = function() use(&$a,&$b){ ... }`
4. 靜態變量 :static $a=0;
> `// 在函數中聲明的靜態變量(每次調用都保留上一次調用的值,全部程序執行完才釋放)`
### 變量函數
1. 如果將一個函數名稱(字符串)賦值給一個變量,然后在這個變量后面加上 ( ) ,就會調用這個變量值對應的函數
### 遞歸函數
1. 在函數中調用自己 就是遞歸函數(一定要寫一個退出循環的條件,避免死循環)
### 加載自定義函數庫
1. include “../../” ; 引入其他文件
2. include_once “.../../“;
3. require(“../../”)
4. require_once(“../../”)
5. 絕對路徑 echo __ DIR__ 獲取當前文件在網站的絕對路徑
6. include __ DIR__.”/../..”