<?php require_once "../vendor/autoload.php"; use Hprose\Future; use Hprose\Http\Client; Future\co(function () { $test = new Client("http://hprose.com/example/"); var_dump((yield $test->hello("hprose"))); $a = $test->sum(1, 2, 3); $b = $test->sum(4, 5, 6); $c = $test->sum(7, 8, 9); var_dump((yield $test->sum($a, $b, $c))); var_dump((yield $test->hello("world"))); });
var_dump((yield $test->hello("yield world2"))); var_dump((yield $test->hello("yield world3"))); var_dump((yield $test->hello("yield world4"))); var_dump((yield $test->hello("yield world5"))); var_dump((yield $test->hello("yield world6"))); } catch (\Exception $e) { echo $e; } }); $var_dump($test->hello("async world1")); $var_dump($test->hello("async world2")); $var_dump($test->hello("async world3")); $var_dump($test->hello("async world4")); $var_dump($test->hello("async world5")); $var_dump($test->hello("async world6")); $test->sum(1, 2)->then(function ($result) use($test) { var_dump($result); return $test->sum($result, 1); })->then(function ($result) use($test) { var_dump($result); return $test->sum($result, 1); })->then(function ($result) use($test) { var_dump($result); return $test->sum($result, 1); })->then(function ($result) use($test) { var_dump($result); return $test->sum($result, 1); })->then(function ($result) use($test) { var_dump($result); return $test->sum($result, 1); })->then(function ($result) {