php - Total sum of string made of numbers
252
I have a string which looks like this
12345 45678 25846 44447
Is there some way to make total sum of these numbers in php?
I am trying to make total price from these numbers.
Thank you.
Answer
Solution:
(
(" ",$input));
For
$input = "12345 45678 25846 44447";
, result is128316
.Answer
Solution:
Just try with:
Output:
Answer
Solution:
You could split the string based on spaces, then do a simple loop like this: