hiphop-php /hphp/test/slow/yield/2164.php

Language PHP Lines 36
MD5 Hash f7f6e8b2fbe46a203a4984b0a2ada145 Estimated Cost $728 (why?)
Repository git://github.com/facebook/hiphop-php.git View Raw File View Project SPDX
 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
<?php

function f($x, $y) {
  yield $x;

  yield $$y;
}
foreach (f(10, 'x') as $x) {
 var_dump($x);
 }
function g() {
  extract(func_get_args(), EXTR_PREFIX_ALL, 'foo');
  yield $foo_0;
  yield $foo_1;
}
foreach (g('hello', 'world') as $x) {
 var_dump($x);
 }
function h($x, $y) {
  $z = 16;
  $arr = compact('x', 'y', 'z');
  yield $arr['z'];
  yield $arr['x'];
  yield $arr['y'];
}
foreach (h(32, 64) as $x) {
 var_dump($x);
 }
function i($x, $y) {
  $arr = compact($x);
  yield $arr[$x];
}
foreach (i('y', 32) as $x) {
 var_dump($x);
 }
Back to Top