How to get the last value in a row of foreach loop?

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
vintoICT
User
Posts: 408

How to get the last value in a row of foreach loop?

Post by vintoICT »

How do i get the last value

foreach ($rows as $row) {
    //print_r($row);

  $balance =  $row['balance'];

i want the last value in $row['balance'];

// $balancedd .= $row['balance'];

i tried end($balancedd) ; but i got and error


vintoICT
User
Posts: 408

Post by vintoICT »

$balancedd .=  $row['balance'] .',';
 $arr=   explode(',', $balancedd);
 $lastbal= $arr[count($arr) -2]; 

this worked . Thank you


Post Reply