summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/test.php
blob: 5fdbcbe1a4544453a9d2dd99abe2ea2effb14bb7 (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
47
48
49
50
51
<?php
if (isset($include)) {
	include (sprintf("%s/web-bootstrap.php", dirname(__FILE__)));
}

$stdout = fopen("php://stdout", "w+");

class phpdbg {
    public function isGreat($greeting = null) {
        printf(
            "%s: %s\n", __METHOD__, $greeting);
        return $this;
    }
}

function test($x, $y = 0) {
	$var = $x + 1;
	$var += 2;
	$var <<= 3;

	$foo = function () {
		echo "bar!\n";
	};

	$foo();

	yield $var;
}

$dbg = new phpdbg();

var_dump(
    $dbg->isGreat("PHP Rocks!!"));

foreach (test(1,2) as $gen)
	continue;

echo "it works!\n";

if (isset($dump))
	var_dump($_SERVER);

function phpdbg_test_ob()
{
	echo 'Start';
	ob_start();
	echo 'Hello';
	$b = ob_get_clean();
	echo 'End';
	echo $b;
}