Arrayaccess interface use, arrayaccess interface
Php//get the methods instance of Arrayaccess//get the properties instance of Arrayaccess $reflection=NewReflectionclass (' arrayaccess '); //Var_dump ($reflection->getmethods ()); Var_dump ($reflection->getproperties ()); classDbtypesImplementsarrayaccess{Private $dbtypes=Array(); //determine if there is Public functionOffsetexists ($offset){ return isset($this->dbtypes[$offset]) ?true:false; } //gets a value Public functionOffsetget ($offset){ if($this->offsetexists ($offset)){ return $this->dbtypes[$offset]; }Else{ return NULL; } } //set a value Public functionOffsetset ($offset,$value){ $this->dbtypes[$offset] =$value; } //Delete a value Public functionOffsetunset ($offset){ unset($this->dbtypes[$offset]); } } $types=Newdbtypes (); Echo $types[' NoSQL '];
http://www.bkjia.com/PHPjc/965028.html www.bkjia.com true http://www.bkjia.com/PHPjc/965028.html techarticle arrayaccess interface use, arrayaccess interface? PHP//Get the methods instance of Arrayaccess//get the properties instance of Arra Yaccess $reflection = new Reflectionclass (' Arra ...