1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files
archived-php-src/ext/standard/tests/array/compact_this.phpt
2016-09-01 13:01:38 +02:00

47 lines
642 B
PHP

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