/
funcall.php
74 lines (69 loc) · 1.46 KB
/
funcall.php
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/*
(user|system)class
static method(none-args or have-args)
none-static method(none-args or have-args)
(user|system)function(none-args or have-args)
include* require*
*/
//dl('funcall.so');
function includePath() {
echo "****************abc\n";
return '../test_include.php';
}
fc_add_pre('include','pre_cb');
fc_add_post('include','post_cb');
echo "first icnlude\n";
//include '../test_include.php';
echo "2nd icnlude\n";
include includePath();
echo "starting ...\n";
function m1() {
return 'm1 ret_v';
}
function m2($a,$b,$c) {
echo "iii2\n";
return 'm2 ret_v';
}
class testc2 {
public function testf() {
echo 'testf';
}
}
function pre_cb($args) {
echo 'pre----------';
var_dump($args);
/*if (count($args)==0) {
echo 'zero';
} else if (count($args)==1) {
echo 'trim';
} else {
$args[2]->testf();
}*/
}
function post_cb($args,$result,$t) {
echo 'post_cb----------';
var_dump($result);
if (count($args)==0) {
echo 'zero';
} else if (count($args)==1) {
echo 'trim';
} else {
$args[2]->testf();
}
}
fc_add_pre('m1','pre_cb');
fc_add_pre('m2','pre_cb');
fc_add_post('m1','post_cb');
fc_add_post('m2','post_cb');
fc_add_post('trim','pre_cb');
fc_add_post('trim','post_cb');
//trim(' ok ');
$t2=new testc2;
m1();
$b=m2('abc',true,$t2);
echo 'XXXXXXXXXXXXXXX--------';
//var_dump(xdebug_get_declared_vars());
echo 'endXXXXXXXXXXXXXXX--------';
trim(' ok ');
die;