12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- --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) {
- }
- }
|