為什么總提示多了個[]
<?php
namespace wh88;
?function sum($a,$b){
?return "{$a} + {$b} =".($a+$b);
?}
?echo sum(2,3);
?echo '<br>';
?//echo call_user_func(要執行的函數,參數1,參數2.。)
?echo call_user_func(__NAMESPACE__.'\sum',3,10);
?echo '<hr>';
?echo call_user_func_array(__NAMESPACE__.'\sum',[30,40]);
?class test
{
public function sum($a,$b){
?return "{$a} + {$b} =".($a+$b);
?}
?}
?$obj=new test();
?echo '<hr>';
echo call_user_func_array([$obj,'sum'],[22,40]);//當使用靜態方法時(static),echo call_user_func_array([test::class,'sum'],[22,40]);
//方法重載
class test1
{
public function __call($whl,$qq){
return '跑偏了';
}
}
echo '<hr>';
$obj=new test1();
echo $obj->www(10,100,30);
2022-09-23
沒有提示呀