Imagine a counter with an initial value of 0 .
For each cycle, increase the counter by 1 using $counter = 0;
The final counter value returned by the loop will be the number of iterations of your for loop. Find the code below:
$counter = 0; foreach ($Contents as $item) { $counter++; $item[number];// if there are 15 $item[number] in this foreach, I want get the value ': 15' }
Try this.
Victor Langat Aug 19 '19 at 12:01 2019-08-19 12:01
source share