理解codeigniter load_class函数中的静态$_class变量声明


Understanding the static $_class variable declaration in codeigniter load_class function

我正在检查CodeIgniter的核心功能,我对变量

的声明有疑问
static $_classes = array();

正如这篇文章指出的,这个变量是用来缓存类对象的。

我怀疑是因为变量是在函数范围内声明的,

是不是每次调用load_class函数时都应该初始化?

函数应该是这样的

static $_classes = array();  //declared outside the scope
function load_class (@prams-----) {
  // inner workings
}

function load_class(@params---) {
  static $_class = array();  // declared inside the scope
  //inner workings
}

如手册中所述,静态变量(仅)在第一次调用函数时初始化。