summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/compact_this.phpt
blob: f3677e03e276cf050fca5614158ec4e8c2976622 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--TEST--
compact() with object context
--FILE--
<?php

var_dump(
    (new class {
        function test(){
            return compact('this');
        }
    })->test()
);

var_dump(
    (new class {
        function test(){
            return compact([['this']]);
        }
    })->test()
);

var_dump(
    (new class {
        function test(){
            return (function(){ return compact('this'); })();
        }
    })->test()
);

?>
--EXPECT--
array(1) {
  ["this"]=>
  object(class@anonymous)#1 (0) {
  }
}
array(1) {
  ["this"]=>
  object(class@anonymous)#1 (0) {
  }
}
array(1) {
  ["this"]=>
  object(class@anonymous)#1 (0) {
  }
}