多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] ## 实例 ``` <?php class demo implements arrayaccess { private $arr=[ 'a'=>'A', 'b'=>'B', ]; public function offsetExists($offset) { return isset($this->arr[$offset]); } public function offsetGet($offset) { return $this->arr[$offset]; } public function offsetSet($offset, $value) { $this->arr[$offset]=$value; } public function offsetUnset($offset) { unset($this->arr[$offset]); } } $demo = new demo(); var_dump($demo['a']); // 'A' unset($demo['a']); var_dump(isset($demo['a'])); // false $demo['c']='C'; var_dump($demo['c']); // 'C' ```