Download src/php/php-src/tests/lang/030.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 691 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/tests/lang/030.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/tests/lang/030.phpt
-
curl -L -o 030.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/tests/lang/030.phpt
691 Bytes
| --TEST-- | |
| $this in constructor test | |
| --FILE-- | |
| class foo { | |
| public $Name; | |
| function __construct($name) { | |
| $GLOBALS['List']= &$this; | |
| $this->Name = $name; | |
| $GLOBALS['List']->echoName(); | |
| } | |
| function echoName() { | |
| $GLOBALS['names'][]=$this->Name; | |
| } | |
| } | |
| function &foo2(&$foo) { | |
| return $foo; | |
| } | |
| $bar1 =new foo('constructor'); | |
| $bar1->Name = 'outside'; | |
| $bar1->echoName(); | |
| $List->echoName(); | |
| $foo = new foo('constructor'); | |
| $bar1 =& foo2($foo); | |
| $bar1->Name = 'outside'; | |
| $bar1->echoName(); | |
| $List->echoName(); | |
| print ($names==array('constructor','outside','outside','constructor','outside','outside')) ? 'success':'failure'; | |
| --EXPECT-- | |
| success | |