summaryrefslogtreecommitdiff
path: root/Zend/tests/closure_016.phpt
blob: 0f87f20f435aaa844a2841252a05a2b3c638544d (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
--TEST--
Closure 016: closures and is_callable()
--FILE--
<?php
class Foo {
    function __invoke() {
        echo "Hello World!\n";
    }
}

function foo() {
    return function() {
        echo "Hello World!\n";
    };
}
$test = new Foo;
var_dump(is_callable($test, true, $name));
echo $name."\n";
var_dump(is_callable($test, false, $name));
echo $name."\n";
var_dump(is_callable(array($test,"__invoke"), true, $name));
echo $name."\n";
var_dump(is_callable(array($test,"__invoke"), false, $name));
echo $name."\n";
$test = foo();
var_dump(is_callable($test, true, $name));
echo $name."\n";
var_dump(is_callable($test, false, $name));
echo $name."\n";
var_dump(is_callable(array($test,"__invoke"), true, $name));
echo $name."\n";
var_dump(is_callable(array($test,"__invoke"), false, $name));
echo $name."\n";
?>
--EXPECT--
bool(true)
Foo::__invoke
bool(true)
Foo::__invoke
bool(true)
Foo::__invoke
bool(true)
Foo::__invoke
bool(true)
Closure::__invoke
bool(true)
Closure::__invoke
bool(true)
Closure::__invoke
bool(true)
Closure::__invoke