fork download
  1. <?php
  2.  
  3. class Test implements ArrayAccess
  4. {
  5. public function offsetSet($offset, $value) {
  6. var_dump(__METHOD__, $value);
  7. }
  8. public function offsetExists($var) {
  9. var_dump(__METHOD__, $var);
  10. return true;
  11. }
  12. public function offsetUnset($var) {
  13. var_dump(__METHOD__);
  14. }
  15. public function offsetGet($var) {
  16. var_dump(__METHOD__, $var);
  17. return "value";
  18. }
  19. }
  20.  
  21. $test = new Test;
  22. var_dump(isset($test['asasas']));
  23.  
  24.  
  25.  
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
string(18) "Test::offsetExists"
string(6) "asasas"
bool(true)