Download src/php/php-src/Zend/tests/constexpr/new_allowed.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 496 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/constexpr/new_allowed.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/constexpr/new_allowed.phpt
-
curl -L -o new_allowed.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/constexpr/new_allowed.phpt
496 Bytes
| --TEST-- | |
| Places where new is allowed | |
| --FILE-- | |
| (new std) | |
| class Test { | |
| public function __construct( | |
| public $prop = new stdClass, | |
| ) { | |
| var_dump($prop); | |
| } | |
| } | |
| function test($param = new stdClass) { | |
| static $var = new stdClass; | |
| var_dump($param, $var); | |
| } | |
| const TEST = new stdClass; | |
| new Test; | |
| test(); | |
| var_dump(TEST); | |
| --EXPECT-- | |
| object(stdClass)#3 (0) { | |
| } | |
| object(stdClass)#2 (0) { | |
| } | |
| object(stdClass)#3 (0) { | |
| } | |
| object(stdClass)#1 (0) { | |
| } | |