3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $numbers = range(0,100); foreach ($numbers as $i) { echo "{$i}: ", ($i -1) % 4, "\n"; }
Output for 4.3.0 - 7.1.0
0: -1 1: 0 2: 1 3: 2 4: 3 5: 0 6: 1 7: 2 8: 3 9: 0 10: 1 11: 2 12: 3 13: 0 14: 1 15: 2 16: 3 17: 0 18: 1 19: 2 20: 3 21: 0 22: 1 23: 2 24: 3 25: 0 26: 1 27: 2 28: 3 29: 0 30: 1 31: 2 32: 3 33: 0 34: 1 35: 2 36: 3 37: 0 38: 1 39: 2 40: 3 41: 0 42: 1 43: 2 44: 3 45: 0 46: 1 47: 2 48: 3 49: 0 50: 1 51: 2 52: 3 53: 0 54: 1 55: 2 56: 3 57: 0 58: 1 59: 2 60: 3 61: 0 62: 1 63: 2 64: 3 65: 0 66: 1 67: 2 68: 3 69: 0 70: 1 71: 2 72: 3 73: 0 74: 1 75: 2 76: 3 77: 0 78: 1 79: 2 80: 3 81: 0 82: 1 83: 2 84: 3 85: 0 86: 1 87: 2 88: 3 89: 0 90: 1 91: 2 92: 3 93: 0 94: 1 95: 2 96: 3 97: 0 98: 1 99: 2 100: 3