Download src/php/php-src/Zend/tests/dereference/dereference_013.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 536 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/dereference/dereference_013.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/dereference/dereference_013.phpt
-
curl -L -o dereference_013.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/dereference/dereference_013.phpt
536 Bytes
| --TEST-- | |
| Testing array dereferencing on array returned from __call method | |
| --FILE-- | |
| error_reporting(E_ALL); | |
| class foo { | |
| public $x = array(2); | |
| public function __call($x, $y) { | |
| if (count($this->x) == 1) { | |
| $this->x[] = $y[0]; | |
| } | |
| return $this->x; | |
| } | |
| } | |
| $foo = new foo; | |
| $x = array(1); | |
| $foo->b($x)[1] = 3; | |
| var_dump($foo->b()[0]); | |
| var_dump($foo->b()[1]); | |
| var_dump($foo->b()[2]); | |
| --EXPECTF-- | |
| int(2) | |
| array(1) { | |
| [0]=> | |
| int(1) | |
| } | |
| Warning: Undefined array key 2 in %s on line %d | |
| NULL | |