Change $i++ to ++$i in php snippet