"; $i++; } while ($i < count($foodArray)); padding: 20px 0 0; padding-top: 58px; 'type' => 'other', .quote { 'url' => 'all', color: #ff8a00; Do the echo within the while() loop itself. You can put the array pointer back with the reset ($myArray) function. justify-content: left; width: 210px; left: 0; margin: 0 -10px 2px; box-shadow: inset 0 2px 10px #c86c00; The list / each construct can be used with both key and value, or just value. .item-buy p { font-family: "Georgia", "Times", serif; Loops work great with arrays. for − loops through a block of code a specified number of times.. while − loops through a block of code if and as long as a specified condition is true.. do...while − loops through a block of code once, and then repeats the loop as long as a special condition is true. font-size: 20px; background-color: #ff8a00; 'discount' => 0, It uses the very same concept for looping and picking out information from the array. margin-right: 10px; .brands-dg::before { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); padding: 0; $product_class = $product_class . ' .order-list img { 'type' => 'lighting', background-image: url("img/brands-ehm-grey.svg"); } background-repeat: no-repeat; display: block; PHP supports four different types of loops. A Loop in PHP is an Iterative Control Structure that involves executing the same number of code a number of times until a certain condition is met. background-color: red; A loop is a statement that allows you to execute the same code more than once.
.map-link:hover, margin: 20px 20px 20px 0; border: 1px solid #c0c0c0; Code Softly Code Softly. } background-repeat: no-repeat; display: flex; width: 10px; $price = get_product_price($id); max-width: 462px; } margin: -1px; width: 510px; The do...while loop - Loops through a block of code once, and then repeats the loop as long as the specified condition is true. PHP loop is the process of executing the same block of code again and again until the specified condition is true. top: 2px; line-height: 20px; ], 'type' => 'furniture', 'colors' => ['blue', 'black'], PHP Code $foodArray = ["Eggs", "Bacon", "HashBrowns", "Beans", "Bread"]; $i = 0; do { echo $foodArray[$i] . .intro-title b, $product_class = 'item'; font-weight: 400; 'name' => 'Textile', .catalog-title, } 'features' => ['Glitters', 'Shines', 'Looks expensive', 'Can be hung'] '19' => [ border: 1px solid #ff8a00; line-height: 24px; display: flex; .social-list a:focus { } return [ .filters { if ($discount > 1400 || $is_last) { display: flex; .product-card:active { color: #000000;