Download src/php/php-src/Zend/tests/ArrayAccess/ArrayAccess_indirect_append.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 760 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/ArrayAccess/ArrayAccess_indirect_append.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/ArrayAccess/ArrayAccess_indirect_append.phpt
-
curl -L -o ArrayAccess_indirect_append.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/ArrayAccess/ArrayAccess_indirect_append.phpt
760 Bytes
| --TEST-- | |
| Using indirect append on ArrayAccess object | |
| --FILE-- | |
| class AA implements ArrayAccess { | |
| private $data = []; | |
| public function &offsetGet($name): mixed { | |
| if (null === $name) { | |
| return $this->data[]; | |
| } else { | |
| return $this->data[$name]; | |
| } | |
| } | |
| public function offsetSet($name, $value): void { | |
| $this->data[$name] = $value; | |
| } | |
| public function offsetUnset($name): void {} | |
| public function offsetExists($name): bool {} | |
| } | |
| $aa = new AA; | |
| $aa[3] = 1; | |
| $aa[][][0] = 2; | |
| var_dump($aa); | |
| --EXPECT-- | |
| object(AA)#1 (1) { | |
| ["data":"AA":private]=> | |
| array(2) { | |
| [3]=> | |
| int(1) | |
| [4]=> | |
| array(1) { | |
| [0]=> | |
| array(1) { | |
| [0]=> | |
| int(2) | |
| } | |
| } | |
| } | |
| } | |