I have an array of strings, and I want to find the sum of the lengths of all the strings in the array. Eg:
$array = ['One', 'Two', 'Three'];
strlen result is
3 3 5
and the sum is 11
. How can this be done?
try this
$array = ['One', 'Two', 'Three'];
echo $total_str_length = array_sum(array_map('strlen', $array));
O/P : 11