How can the result of a function be assigned to a variable?

<?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));

what I want to achieve is that no matter how many variables are passed into the function, the sum of the length of all characters can be calculated automatically, but now there is no way to assign the result to the variable and ask for advice

Php
Mar.22,2021

function totalLen(...$string){
    $lens = [];
    foreach ($string as $content) {
      $lens[] = strlen($content);
    }
    reutrn $lens;
}
Menu