How to calculate how many items in a foreach?
I want to count total rows.
foreach ($Contents as $item) {
$item[number];// if there are 15 $item[n
There's a few different ways you can tackle this one.
You can set a counter before the foreach() and then just iterate through which is the easiest approach.
$counter = 0;
foreach ($Contents as $item) {
$counter++;
$item[number];// if there are 15 $item[number] in this foreach, I want get the value : 15
}