1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/property_hooks/generator_hook.phpt
2024-07-14 11:55:03 +02:00

46 lines
539 B
PHP

--TEST--
Generator hook
--FILE--
<?php
class A {
public $backed = 2 {
get {
yield 1;
yield $this->backed;
yield 3;
}
}
public $virtual {
get {
yield 1;
yield 2;
yield 3;
}
}
}
$a = new A();
var_dump(iterator_to_array($a->backed));
var_dump(iterator_to_array($a->virtual));
?>
--EXPECT--
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}