display: block; .contacts-info p { max-width: 462px; cursor: pointer; .features-title, 'is_new' => true, 'features' => ['Soft', 'Cozy', 'Cats and children love it', 'Hides stains', 'Easy to clean'] border-radius: 50%; margin: 8px 0 10px 20px; ],
font-size: 18px; .order-list th:last-child { 'title' => 'Rmaeribi sofa', .price-old i { background-image: url("img/feature-protected.svg"); font-family: "Georgia", "Times", serif; } } ], box-shadow: inset 0 2px 10px #c86c00; font-family: "Georgia", "Times", serif; .contact-phone::before { Embedding the while loop in the template, 7. } ], 'title' => 'Tre furniture set', PHP supports different types of loops to iterate through a given block of code. .products-title { font-weight: 400; display: block;
'price' => 3500, .navigation-list { right: 0; The actions specified in the loop body will be executed repeatedly until the condition becomes false. width: 510px; '4' => [ item-new'; '20' => [ 'is_last' => false, } .filters { color: #ff8a00; Let’s automate the addition of these elements to the page in order to save ourselves from having to perform such monotonous work repeatedly. background-color: green; Adding an element to the array by index, 6. .order-list th:last-child { ], background-position: center left; content: ""; - Catalog
.product-card { margin: 10px 0 8px; padding: 0 20px; left: 80px; 'is_new' => true, margin-left: auto; PHP while loop executes a block of code again and again until the given condition is true. justify-content: left; display: block; The while loop is probably the most popular because of the recognizable and meaningful name. "; 'features' => ['Adhere permanently', 'Bright', 'Funny', 'Stylish', 'Do not launder'] .intro .container { } height: 13px; 'is_last' => true, opacity: 0.3; 'title' => 'Omase pillow', } line-height: 36px; } } .item, ], } 'is_new' => true, The list / each construct can be used with both key and value, or just value. Use the .= operator to keep concatenating onto $product_list so that you can echo it later. line-height: 36px; .custom-columns img { .filter:active { .site-footer { null; border-radius: 4px; .item-new .item-title::after { 'title' => 'Blempere stickers', '15' => [ So, the while loop will keep on executing until it reaches the maximum length of the array. } } } .feature-protected { padding: 0 0 0 33px; The following example produces the same result as the second foreach example shown above: line-height: 14px; .delivery, To start with, each() will return the first element, then the second element, then the third, and so on, until it finds there are no elements left, in which case it will return false and end the loop. If you need to go through an array, than use the PHP foreach loop.
'type' => 'lighting', For example, it instantly exposes a count of the array which is quick and useful. Let’s start with the while loop. 'title' => 'Mseyulida lamp', .color-green { background-color: #f8f8f8; return get_product_attribute($id, 'price'); margin-bottom: 10px; } } 'is_new' => true, margin: 16px -20px 0 0; 'is_last' => false, box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); 'is_last' => true, 'img_url' => 'img/item-tueta.jpg', 'discount' => 500, .item-advantages li { color: #845927; color: #000000; font-size: 13px; margin-left: 4px; Plot number of bacteria versus time. } 'is_new' => true,
.social-list { 'price' => 5000, top: 2px; An initial counter set to a certain value, usually zero. .navigation-list a:focus { 'type' => 'lighting', } do…while — the block of code executed once and then condition is evaluated. .brands-title b, } ], .features-title b, color: #ff8a00; 'is_last' => false, .order-list tr { color: #ffffff; .map-link { font-family: "Georgia", "Times", serif; background-repeat: no-repeat; while (loop condition) { loop body } } .copyright { padding-top: 15px; position: relative;