font-size: 28px; .logo-link img { background-image: url("img/icon-pin.svg"); 'title' => 'Briatuo armchairs', font-weight: 400; Privacy ∙ box-shadow: inset 0 2px 10px #c86c00; margin: -1px; 'img_url' => 'img/item-badeta.jpg', padding: 0; display: flex; font-weight: 400; PHP Arrays and While Loops. 3 => [ color: #ffffff; .product-card:active { background-image: url("img/index-background.jpg");
'features' => ['Glitters', 'Shines', 'Looks expensive', 'Can be hung'] Write a while loop in the product.php script. margin: 20px 0 20px; top: 10px; position: absolute; For example, it instantly exposes a count of the array which is quick and useful. Otherwise, the loop would run for an infinite number of times, and the page would never finish loading. } .delivery-background { } ]; background-color: #ff8a00; color = array('white', 'green', 'red'') Go to the editor. 'price' => 2200, '9' => [ Twitter 'is_last' => false, 1 1 1 bronze badge. 'features' => ['Helps you read at night', 'Small', 'Exudes a cozy glow', 'Doesn’t bother others'] list-style: none; In some cases, one will perform better than the other with regards to what you need to achieve. vertical-align: bottom; list-style: none; return get_product_attribute($id, 'img_url'); ], padding: 0; .brands-ehm:hover::before { 'features' => ['For the Marvel fan', 'You can plant a flower', 'Glorious', 'Makes you smile'] .intro-title b, 0 => [ ], } You are more likely to see this as part of PHP classes and heavily object-oriented projects. This means the second while loop on that array will be skipped! } .button { font-family: "Arial", "Helvetica", sans-serif; return get_product_attribute($id, 'is_new'); background-color: #ff8a00; .products-list { flex-wrap: wrap; font-size: 15px; 'discount' => 5500, font-family: "Georgia", "Times", serif; 'colors' => ['blue'], Loops work great with arrays. '11' => [ } left: -14px; min-height: 200px; margin: 0; Loading…Everything will be ready in few seconds. box-sizing: border-box; background-color: #fff3e5; Have you forgotten your password or lost access to your profile? padding: 0; 'price' => 100, PHP. flex-wrap: wrap; margin-left: 15px; 'price' => 10000, .map-link:focus { 'features' => ['Vivid', 'Deep', 'Beautiful', 'Relaxing', 'Comfortable for your back'] .brands-tehnodom::before { item-new'; } flex-wrap: wrap; margin: 8px 0 10px; font-size: 16px; 'name' => 'Lighting', margin-top: auto; width: 110px;

.brands-list li::before { require('components/footer.php'); margin-bottom: 6px; padding: 0; color: #ff8a00; font-family: "Georgia", "Times", serif; .site-navigation { 'is_last' => true, top: 0; color: #ff8a00; .item-hot .item-img { PHP supports four different types of loops. .catalog-title, position: absolute; 'colors' => ['orange'], In this example, an array of five elements is created. min-height: 200px; } 'is_last' => false, line-height: 20px; border: 1px solid #ff8a00; align-items: center; font-style: italic; flex-direction: column; .order-list tr { margin: 10px 0 8px; 'img_url' => 'img/item-rmob.jpg', background-color: green; padding: 10px; To achieve this, another variable must be created, an index indicator variable that does two things, allows us to pick out each of the values in the array as well as instructing the while loop when to stop. margin: 8px; .item-buy { .brands-list li { } content: "The product will soon sell out! In order to output all values from this array to the console, use the while loop: Each execution of a block of code in the loop body is called an iteration. .order { } line-height: 36px; background-image: url("img/brands-dg.svg"); 'type' => 'lighting', width: 112px; .navigation-list a:hover, height: 6px; right: 0; .price { font-style: italic; The loop first test the condition if it is true and if the condition is true, it executes the code and returns back to check the condition if it is true. background-image: url("img/feature-protected.svg"); padding: 0;