added changes to make code more succinct for foreach_2.php