<?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)會(huì)得到6,8,69,但是貌似不能賦值給$arrNum
echo array_sum(array($arrNum));
我想實(shí)現(xiàn)的功能是,無(wú)論有多少變量傳入函數(shù),都能自動(dòng)計(jì)算出所有字符的長(zhǎng)度的和,但是現(xiàn)在沒辦法把得到的結(jié)果賦值給變量,求指教
函數(shù)的結(jié)果怎么賦值給變量啊
幕布斯6054654
2019-03-12 14:23:19