Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > f896334bb2c22037ad058c69a8e9b558 > files > 7

php-funcall-0.2.5-4mdv2009.1.i586.rpm

--TEST--
Checking functions
--SKIPIF--
<?php if (!extension_loaded("funcall")) print "skip"; ?>
--FILE--
<?php
function m1() {
    return 0;
}
function m2($a,$b,$c) {
    return 2;
}
class testc2 {
    public function testf() {
        echo 'testf';
    }
}
function pre_cb($args) {
    if (count($args)==0) {
        echo 'zero';
    } else if (count($args)==1) {
        echo 'trim';
    } else {
        $args[2]->testf();
    }
}
function post_cb($args,$result,$t) {
    if (count($args)==0) {
        echo 'zero';
    } else if (count($args)==1) {
        echo 'trim';
    } else {
        $args[2]->testf();
    }
    echo $result;
}
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');

$t2=new testc2;

m1();
m2('abc',true,$t2);
trim(' ok ');
?>
--EXPECT--
zerozero0testftestf2trimtrimok