コード例 #1
0
ファイル: bug54039.php プロジェクト: badlamer/hhvm
$f();
$f = test_1();
$f();
function test_2()
{
    static $v = 0;
    $f = function () use($v) {
        echo "Inner function reckons \$v is {$v}\n";
    };
    ++$v;
    echo "Outer function increments \$v to {$v}\n";
    return $f;
}
$f = test_2();
$f();
$f = test_2();
$f();
function test_3()
{
    static $v = "";
    $v .= 'b';
    echo "Outer function catenates 'b' onto \$v to give {$v}\n";
    $f = function () use($v) {
        echo "Inner function reckons \$v is {$v}\n";
    };
    $v .= 'a';
    echo "Outer function catenates 'a' onto \$v to give {$v}\n";
    return $f;
}
$f = test_3();
$f();
コード例 #2
0
ファイル: mq_php_func_test.php プロジェクト: i4oolish/ucmq
function main($ip, $port, $name, $t, $char)
{
    #避免打出无关信息
    error_reporting(E_ALL & ~E_NOTICE);
    #test_put( $ip, $port, $name, $t, $char, 500000000);
    #test_get( $ip, $port, $name, $t, $char, 500);
    //未初始化队列的操作
    test_1($ip, $port, $name, $t, $char);
    //已使用队列操作
    test_2($ip, $port, $name, $t, $char);
    //队列名为空测试
    test_3($ip, $port, $name, $t, $char);
    //超时中断测试
    test_4($ip, $port, $name, $t, $char);
    //循环put 10条
    test_5($ip, $port, $name, $t, $char, 10);
    //循环get 10条
    test_6($ip, $port, $name, $t, $char, 10);
    #测试错误的opt
    test_7($ip, $port, $name, $t, $char);
    #对重置队列的操作
    test_8($ip, $port, $name, $t, $char);
    echo "-----test end------\n";
    global $success;
    echo "--success [{$success}]---\n";
    global $fail;
    echo "--fail [{$fail}]--\n";
}