<?php $arr = [1,2,0,3]; $len = count($arr); do { echo current($arr).PHP_EOL; next($arr); $len --; }while($len);