fork download
  1. <?php
  2.  
  3. class Pituh implements ArrayAccess {
  4. private $data;
  5. public function offsetExists ($offset) {
  6. return isset($this->data[serialize($offset)]);
  7. }
  8. public function offsetGet ($offset) {
  9. return $this->data[serialize($offset)];
  10. }
  11. public function offsetSet ($offset, $value) {
  12. $this->data[serialize($offset)] = $value;
  13. }
  14. public function offsetUnset ($offset) {
  15. unset($this->data[serialize($offset)]);
  16. }
  17. }
  18.  
  19. $a = new Pituh;
  20.  
  21. $a[['какой']] = 'багор';
  22.  
  23. echo $a[['какой']];
  24.  
Success #stdin #stdout 0.02s 24484KB
stdin
Standard input is empty
stdout
багор