I want to print number of objects according to this pattern:
If there is 1 object, print 0
If there is 2 objects, print 0 1
If there is 3 objects, print 0 1 2
I tried the following code:
for($i = count($nodes) ; $i >= 0 ; $i--){
print $i;
}
but the result is:
If there is 1 object, print 0 1
If there is 2 objects, print 0 1 2
if there is 3 objects, print 0 1 2 3
Which I can’t use. How can I achieve this?
you should use like this: