<?php $array = [0, 1, 2];foreach ($array as $val) { //reset($array); var_dump(current($array)); var_dump($val);}
Standard input is empty
int(0) int(0) int(0) int(1) int(0) int(2)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!