This has me banging my head against the desk either because I just suck as visualizing math issues or else because I’m in a hurry but I’m hoping some of you can help a guy through this…
I’m trying to calculate the current progress of iteration with an array that is comprised of numerical keys (the values of each element have nothing to do with this–I’m basing the calculation off of the keys only).
Example:
if $array has 4 elements (i.e. - $array[0], $array[1], and so on), how might one return the “percentage progress” after each iteration of the array in a foreach loop?
(I.e. - after iterating past $array[0], the percentage complete would be 25%, and then after iterating after $array[1], it would be 50%, etc.)
Any insight into this likely trivial issue would be very appreciated.