<?php function test(Closure $call) { $a = 63; $b = 22; echo "hello"; echo $call($a,$b); } $func = function($a,$b){ return $a + $b; }; test($func); //調用順序 先調用test ,輸出hello 然后$call是個閉包,執行這個函數,傳遞兩個值過去,想加后返回
[root@localhost swoole]# php time.php
hello85[root@localhost swoole]#