I have a text area in my html form.I am collecting the data from this form using POST method.Here I need to set a blank line as a boundary to repeat a function using this form data. for example I am calculating the sum of the digits which are collected from this text area using below code
<?php
$devices = $_POST['devs'];
$count = array_sum(explode("\n", $devices));
echo "sum is $count";
?>
If I enter below digits
1
2
3
I will get output like:
sum is 6
and what I need is, if I put digits like
1
2
3
4
5
6
I need output like
sum is 6
sum is 15
how can I do it ?