<?php
$name = 'stefen';
$tel = '10795856';
$motto = 'If you shed tears when you miss the sun,then you would miss the stars';
function totalLen(...$string){
//=print_r($string);
foreach ($string as $content) {
echo strlen($content).',';
}
}
$arrNum = totalLen($name,$tel,$motto);
//totalLen($name,$tel,$motto)會得到6,8,69,但是貌似不能賦值給$arrNum
echo array_sum(array($arrNum));
我想實現的功能是,無論有多少變量傳入函數,都能自動計算出所有字符的長度的和,但是現在沒辦法把得到的結果賦值給變量,求指教
函數的結果怎么賦值給變量啊
幕布斯6054654
2019-03-12 14:23:19
