<?php
require('products_db.php');
$products = get_products();
$limit = 6;
$page = intval($_GET['page']) ?: 1;
$offset = ($page - 1) * $limit;
$products_on_page = array_slice($products, $offset, $limit, true);
$products_quantity = count($products);
$pages = $products_quantity / $limit;
$pages_total = ceil($pages);
$today = date('j F y');
require('components/header.php');
require('components/products_list.php');
require('components/footer.php');
<footer class="site-footer">
<div class="container">
<p class="copyright">© Muffin, 2019</p>
<ul class="navigation-list">
<li><a href="catalog.php">Catalog</a></li>
<li><a href="delivery.php">Delivery</a></li>
<li><a href="cart.php">Cart</a></li>
</ul>
<ul class="social-list">
<li>
<a class="social-link-twitter" href="https://twitter.com">
<span class="visually-hidden">Twitter</span>
</a>
</li>
<li>
<a class="social-link-instagram" href="https://instagram.com">
<span class="visually-hidden">Instagram</span>
</a>
</li>
<li>
<a class="social-link-facebook" href="https://facebook.com">
<span class="visually-hidden">Facebook</span>
</a>
</li>
</ul>
</div>
</footer>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Online store for home furnishings</title>
<link href="style.css" rel="stylesheet">
</head>
<body>
<header class="site-header">
<nav class="site-navigation">
<a class="logo-link" href="index.php">
<img src="img/logo-full.svg" width="62" height="17" alt="Gloevk store logo">
</a>
<ul class="navigation-list">
<li><a href="catalog.php">Catalog</a></li>
<li><a href="delivery.php">Delivery</a></li>
<li><a href="cart.php">Cart</a></li>
</ul>
</nav>
</header>
<section class="banner">
<p>Marketers have declared that 01/01/1970 is the best time to shop!</p>
</section>
<section class="catalog">
<div class="container">
<h1 class="catalog-title">Product catalog</h1>
<ol class="pagination">
<?php for ($i = 1; $i <= $pages_total; $i = $i + 1): ?>
<li>
<a href="catalog.php?page=<?= $i ?>" class="<?= $i === $page ? 'current' : '' ?>"><?= $i ?></a>
</li>
<?php endfor; ?>
</ol>
<ul class="products-list">
<?php foreach($products_on_page as $i => $item): ?>
<li>
<a class="product-card" href="product.php?product_id=<?= $i ?>">
<h3><?= $item['title'] ?></h3>
<img src="<?= $item['img_url'] ?>" width="156" height="120" alt="<?= $item['title'] ?>">
<div class="product-options">
<span class="price"><?= $item['price'] ?></span>
<ul class="colors-list">
<?php foreach ($item['colors'] as $color): ?>
<li class="color-<?= $color ?>"></li>
<?php endforeach;?>
</ul>
</div>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</section>
<?php
function get_products() {
return [
'1' => [
'title' => 'Asusmer hanging bed',
'img_url' => 'img/item-asusmer.jpg',
'price' => 10000,
'discount' => 1000,
'is_new' => true,
'is_last' => false,
'type' => 'furniture',
'colors' => ['blue'],
'features' => ['Pleases cats', 'Inspires envy', 'Hangs firmly', 'Soft', 'Stylish', 'Yours', 'Doesn’t swing like a baby’s cradle', 'Waits for you at home']
],
'2' => [
'title' => 'Badeta armchair',
'img_url' => 'img/item-badeta.jpg',
'price' => 3500,
'discount' => 0,
'is_new' => false,
'is_last' => false,
'type' => 'furniture',
'colors' => ['blue', 'black'],
'features' => ['Shakes the apartment', 'Cozy', 'Hangs firmly', 'It’s just as if grandma knitted it']
],
'3' => [
'title' => 'Blempere stickers',
'img_url' => 'img/item-blempere.jpg',
'price' => 500,
'discount' => 0,
'is_new' => false,
'is_last' => true,
'type' => 'other',
'colors' => ['blue', 'black', 'red'],
'features' => ['Adhere permanently', 'Bright', 'Funny', 'Stylish', 'Do not launder']
],
'4' => [
'title' => 'Bletub chandelier',
'img_url' => 'img/item-bletub.jpg',
'price' => 4000,
'discount' => 0,
'is_new' => true,
'is_last' => true,
'type' => 'lighting',
'colors' => ['red'],
'features' => ['The cat cannot reach it', 'It hangs firmly in place', 'Shines brightly']
],
'5' => [
'title' => 'Breirbury organizer',
'img_url' => 'img/item-breirberi.jpg',
'price' => 5000,
'discount' => 3000,
'is_new' => true,
'is_last' => true,
'type' => 'other',
'colors' => ['yellow'],
'features' => ['So that your junk is always an arm’s reach away', 'Convenient', 'You can cook and watch a movie at the same time']
],
'6' => [
'title' => 'Mseyulida lamp',
'img_url' => 'img/item-mseyulida.jpg',
'price' => 4000,
'discount' => 500,
'is_new' => true,
'is_last' => false,
'type' => 'lighting',
'colors' => ['orange', 'green', 'yellow', 'blue', 'black'],
'features' => ['Suitable for any interior', 'Sturdy']
],
'7' => [
'title' => 'Rmaeribi sofa',
'img_url' => 'img/item-rmaeribi.jpg',
'price' => 15000,
'discount' => 4500,
'is_new' => true,
'is_last' => true,
'type' => 'furniture',
'colors' => ['green', 'black', 'red', 'blue'],
'features' => ['Soft', 'Cozy', 'Cats and children love it', 'Hides stains', 'Easy to clean']
],
'8' => [
'title' => 'Nnulm desk',
'img_url' => 'img/item-nnulm.jpg',
'price' => 5000,
'discount' => 0,
'is_new' => true,
'is_last' => false,
'type' => 'furniture',
'colors' => ['green'],
'features' => ['Eco-friendly', 'Lots of drawers', 'It has room for a mug and a pile of papers']
],
'9' => [
'title' => 'Tre furniture set',
'img_url' => 'img/item-tre.jpg',
'price' => 20000,
'discount' => 3000,
'is_new' => true,
'is_last' => true,
'type' => 'furniture',
'colors' => ['yellow', 'black'],
'features' => ['Relaxes', 'Doesn’t creak', 'Looks cool']
],
'10' => [
'title' => 'Granny style chandelier',
'img_url' => 'img/item-default-old-lamp.jpg',
'price' => 7000,
'discount' => 2000,
'is_new' => false,
'is_last' => true,
'type' => 'lighting',
'colors' => ['blue', 'black'],
'features' => ['Nostalgic', 'Fits into any interior', 'Your neighbors will envy it', 'Stylish']
],
'11' => [
'title' => 'Do lamp',
'img_url' => 'img/item-do.jpg',
'price' => 3500,
'discount' => 500,
'is_new' => true,
'is_last' => false,
'type' => 'lighting',
'colors' => ['black'],
'features' => ['Looks beautiful', 'Shines']
],
'12' => [
'title' => 'Tueta panel',
'img_url' => 'img/item-tueta.jpg',
'price' => 5000,
'discount' => 20,
'is_new' => true,
'is_last' => true,
'type' => 'textile',
'colors' => ['red'],
'features' => ['Will surprise your guests', 'It makes you want to touch it', 'Eye-catching']
],
'13' => [
'title' => 'Nmiao pillow',
'img_url' => 'img/item-nmyao.jpg',
'price' => 1500,
'discount' => 0,
'is_new' => false,
'is_last' => false,
'type' => 'textile',
'colors' => ['orange'],
'features' => ['Cozy for the cat', 'Comfortable for you', 'Fun for your kid']
],
'14' => [
'title' => 'Kel lamp',
'img_url' => 'img/item-kel.jpg',
'price' => 3000,
'discount' => 20,
'is_new' => true,
'is_last' => false,
'type' => 'lighting',
'colors' => ['orange', 'blue'],
'features' => ['Helps you read at night', 'Small', 'Exudes a cozy glow', 'Doesn’t bother others']
],
'15' => [
'title' => 'Omase pillow',
'img_url' => 'img/item-omase.jpg',
'price' => 2000,
'discount' => 100,
'is_new' => true,
'is_last' => true,
'type' => 'textile',
'colors' => ['grey', 'black'],
'features' => ['Brightly colored', 'Square', 'Soft']
],
'16' => [
'title' => 'Ormu basket',
'img_url' => 'img/item-ormu.jpg',
'price' => 2200,
'discount' => 20,
'is_new' => true,
'is_last' => false,
'type' => 'other',
'colors' => ['blue'],
'features' => ['Everything fits', 'You can plant a flower in it', 'Hides the cat']
],
'17' => [
'title' => 'Pinas paperclips',
'img_url' => 'img/item-pinas.jpg',
'price' => 100,
'discount' => 0,
'is_new' => true,
'is_last' => true,
'type' => 'other',
'colors' => ['blue', 'black'],
'features' => ['Do not rust', 'Strong', 'You get a bunch of them', 'There is enough to last a long time']
],
'18' => [
'title' => 'Preum compact cassette',
'img_url' => 'img/item-preum.jpg',
'price' => 200,
'discount' => 20,
'is_new' => true,
'is_last' => false,
'type' => 'other',
'colors' => ['blue', 'black'],
'features' => ['Soothing', 'Surprise your teen', 'You can rewind the tape with a pencil']
],
'19' => [
'title' => 'Rmob souvenir',
'img_url' => 'img/item-rmob.jpg',
'price' => 1500,
'discount' => 20,
'is_new' => false,
'is_last' => false,
'type' => 'other',
'colors' => ['green', 'orange', 'yellow'],
'features' => ['For the Marvel fan', 'You can plant a flower', 'Glorious', 'Makes you smile']
],
'20' => [
'title' => 'Tkuoko chandelier',
'img_url' => 'img/item-tkuoko.jpg',
'price' => 2100,
'discount' => 1000,
'is_new' => false,
'is_last' => false,
'type' => 'lighting',
'colors' => ['green', 'orange'],
'features' => ['Glitters', 'Shines', 'Looks expensive', 'Can be hung']
],
'21' => [
'title' => 'Briatuo armchairs',
'img_url' => 'img/item-briatuo.jpg',
'price' => 7000,
'discount' => 5500,
'is_new' => false,
'is_last' => true,
'type' => 'furniture',
'colors' => ['blue'],
'features' => ['Vivid', 'Deep', 'Beautiful', 'Relaxing', 'Comfortable for your back']
]
];
}
function get_filters() {
return [
0 => [
'url' => 'all',
'name' => 'All products',
],
1 => [
'url' => 'lighting',
'name' => 'Lighting',
],
2 => [
'url' => 'furniture',
'name' => 'Furniture',
],
3 => [
'url' => 'textile',
'name' => 'Textile',
],
4 => [
'url' => 'other',
'name' => 'Other',
]
];
}
function get_product_attribute($id, $attr) {
$products = get_products();
$result = $products[$id][$attr] ?? null;
return $result;
}
function get_product_price($id) {
return get_product_attribute($id, 'price');
}
function get_product_title($id) {
return get_product_attribute($id, 'title');
}
function get_img_url($id) {
return get_product_attribute($id, 'img_url');
}
function get_product_discount($id) {
return get_product_attribute($id, 'discount');
}
function get_product_is_new($id) {
return get_product_attribute($id, 'is_new');
}
function get_product_is_last($id) {
return get_product_attribute($id, 'is_last');
}
function get_product_features($id) {
return get_product_attribute($id, 'features');
}
.visually-hidden:not(:focus):not(:active),
input[type="checkbox"].visually-hidden,
input[type="radio"].visually-hidden {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
border: 0;
padding: 0;
white-space: nowrap;
clip-path: inset(100%);
clip: rect(0 0 0 0);
overflow: hidden;
}
body {
min-width: 550px;
padding: 0;
margin: 0;
font-family: "Arial", "Helvetica", sans-serif;
font-size: 13px;
line-height: 18px;
}
a {
text-decoration: none;
color: inherit;
}
.container {
width: 510px;
padding: 0 20px;
margin: 0 auto;
}
.site-navigation {
display: flex;
width: 510px;
padding: 0 20px;
margin: 0 auto;
justify-content: space-between;
}
.site-header {
position: relative;
z-index: 2;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.logo-link:hover,
.logo-link:focus {
opacity: 0.5;
}
.logo-link:active {
opacity: 0.3;
}
.logo-link img {
margin: 10px 0;
}
.navigation-list {
display: flex;
margin: 0 -15px 0 0;
padding: 0;
list-style: none;
flex-wrap: wrap;
justify-content: flex-end;
}
.navigation-list a:hover,
.navigation-list a:focus {
opacity: 0.5;
}
.navigation-list a:active {
color: #ff8a00;
}
.navigation-list a {
display: block;
padding: 12px 15px 11px;
color: #845927;
}
.intro .container {
z-index: -1;
min-height: 160px;
margin-bottom: 0;
padding: 20px 0 0;
box-sizing: border-box;
background-image: url("img/index-background.jpg");
background-repeat: no-repeat;
background-position: top right;
}
.intro-title {
width: 240px;
padding: 0;
margin: 0;
font-family: "Georgia", "Times", serif;
font-size: 28px;
line-height: 36px;
font-weight: 400;
}
.brands-title b,
.intro-title b,
.features-title b,
.delivery-text b {
font-weight: 400;
color: #ff8a00;
}
.intro p {
width: 210px;
margin: 8px 0 10px;
padding: 0;
line-height: 20px;
}
.quote {
display: block;
position: relative;
padding: 0 0 0 33px;
margin: 20px 0 20px;
font-family: "Georgia", "Times", serif;
font-style: italic;
}
.quote p {
padding: 0;
margin: 0;
font-size: 16px;
line-height: 24px;
quotes: none;
}
.quote::before {
position: absolute;
content: "«";
top: 0;
left: 0;
font-size: 36px;
color: #ff8a00;
}
.author {
display: block;
padding: 0;
margin: 4px 0;
}
.popular-products {
margin: 0;
background-color: #fff3e5;
}
.delivery,
.custom,
.contacts,
.catalog,
.item,
.order {
padding-top: 15px;
padding-bottom: 10px;
}
.delivery-title,
.custom-title,
.contacts-title,
.catalog-title,
.order-title {
padding: 0;
margin: 5px 0;
font-family: "Georgia", "Times", serif;
font-size: 28px;
line-height: 36px;
font-weight: 400;
}
.filters {
display: flex;
flex-wrap: wrap;
margin: 10px -10px -10px 0;
padding: 0;
list-style: none;
}
.filter {
display: flex;
padding: 8px 16px;
margin: 0 10px 10px 0;
color: #ff8a00;
border: 1px solid #ff8a00;
border-radius: 4px;
cursor: pointer;
}
.filter:focus,
.filter:hover {
color: #ffffff;
background-color: #ff8a00;
}
.filter:active {
box-shadow: inset 0 2px 10px #c86c00;
}
.filter.filter-current {
color: #ffffff;
background-color: #ff8a00;
box-shadow: inset 0 2px 10px #c86c00;
cursor: default;
}
.custom-columns {
display: flex;
flex-grow: 0;
}
.custom-columns img {
display: flex;
flex-shrink: 0;
align-items: center;
margin: 20px 20px 20px 0;
min-height: 200px;
}
.custom-columns div {
margin: 5px 0 20px;
}
.products-list {
display: flex;
padding: 20px 0 0;
margin: 0 0 0 -20px;
flex-wrap: wrap;
flex-shrink: 0;
list-style: none;
}
.products-list li {
display: flex;
}
.product-card {
position: relative;
display: flex;
width: 132px;
margin-bottom: 20px;
margin-left: 20px;
padding: 124px 12px 12px;
flex-direction: column;
background-color: #ffffff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.product-card-new {
position: relative;
}
.product-card-new::after {
position: absolute;
content: "new";
width: 34px;
height: 15px;
top: 8px;
right: -2px;
font-weight: 700;
line-height: 14px;
color: #ffffff;
text-align: center;
background-color: #ff8a00;
border-radius: 4px 0 0 4px;
}
.product-card:hover,
.product-card:focus {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.product-card:active {
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.product-card img {
position: absolute;
top: 0;
left: 0;
order: -1;
}
.product-card h3 {
margin: 0 0 2px 0;
padding: 0;
font-family: "Georgia", "Times", serif;
font-size: 15px;
line-height: 18px;
font-weight: 400;
}
.product-card p {
margin: 0 0 8px 0;
padding: 0;
font-family: "Georgia", "Times", serif;
font-style: italic;
font-size: 13px;
line-height: 16px;
}
.product-options {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: auto;
}
.price {
margin-right: 10px;
flex-shrink: 1;
font-weight: 700;
font-size: 15px;
color: #ff8a00;
}
.price::after {
content: "₽";
}
.colors-list {
display: flex;
margin: 4px 0 0 -4px;
padding: 0;
list-style: none;
}
.colors-list li {
box-sizing: border-box;
width: 10px;
height: 10px;
margin-left: 4px;
border-radius: 50%;
}
.color-orange {
background-color: orange;
}
.color-yellow {
background-color: yellow;
}
.color-green {
background-color: green;
}
.color-red {
background-color: red;
}
.color-blue {
background-color: blue;
}
.color-black {
background-color: black;
}
.color-white {
background-color: white;
border: 1px solid #c0c0c0;
}
.price del {
margin-right: 2px;
font-weight: 400;
font-size: 13px;
color: #000000;
text-decoration: line-through;
}
.map-link {
display: block;
margin-top: -20px;
margin-bottom: 30px;
color: #845927;
}
.map-link:hover,
.map-link:focus {
opacity: 0.5;
}
.map-link:active {
color: #ff8a00;
}
.contacts img {
display: flex;
flex-shrink: 0;
align-items: center;
margin: 20px 0 30px;
min-height: 200px;
}
.item-title {
display: inline-block;
vertical-align: baseline;
padding-right: 50px;
margin: 5px 0 0;
font-family: "Georgia", "Times", serif;
font-size: 28px;
line-height: 36px;
font-weight: 400;
}
.item-new {
position: relative;
}
.item-new::after {
position: absolute;
content: "new";
width: 38px;
height: 16px;
top: 13px;
right: 0;
font-family: "Arial", "Helvetica", sans-serif;
font-size: 15px;
font-weight: 700;
line-height: 14px;
color: #ffffff;
text-align: center;
background-color: #ff8a00;
border-radius: 4px;
}
.item-container {
display: flex;
}
.item-img {
display: flex;
flex-shrink: 0;
margin: 20px 0;
}
.item-hot .item-img {
position: relative;
padding-top: 36px;
}
.item-hot .item-img::before {
position: absolute;
content: "";
width: 290px;
height: 36px;
top: 0;
left: 0;
background-color: #fff3e5;
background-image: url("img/icon-hot.svg");
background-repeat: no-repeat;
background-size: 11px 14px;
background-position: 62px 10px;
}
.item-hot .item-img::after {
position: absolute;
content: "The product will soon sell out!";
top: 10px;
left: 80px;
}
.item-info {
margin: 8px 0 10px 20px;
flex-grow: 1;
}
.title-advantages {
margin: 10px 0 8px;
font-family: "Georgia", "Times", serif;
font-size: 15px;
line-height: 22px;
font-weight: 400;
}
.item-advantages {
margin: 0;
padding-left: 14px;
padding-bottom: 12px;
border-bottom: 1px solid #e2e2e2;
font-family: "Georgia", "Times", serif;
font-style: italic;
list-style: none;
}
.item-advantages li {
position: relative;
margin-bottom: 6px;
}
.item-advantages li::before {
position: absolute;
content: "";
width: 6px;
height: 6px;
top: 6px;
left: -14px;
background-color: #000000;
border-radius: 50%;
}
.item-buy {
display: flex;
flex-wrap: wrap;
margin: 16px 0 0;
}
.item-buy .price {
display: flex;
flex-wrap: wrap;
align-items: baseline;
position: relative;
max-width: 510px;
margin-top: -2px;
margin-bottom: 10px;
flex-shrink: 0;
}
.item-buy p {
margin: 0 30px 10px 0;
word-wrap: break-word;
}
.item-buy i {
display: block;
margin-bottom: 2px;
font-family: "Georgia", "Times", serif;
font-style: italic;
font-size: 13px;
font-weight: 400;
color: #000000;
}
.price-old i {
margin-bottom: 3px;
}
p.price-new {
margin-right: 0;
font-weight: 700;
font-size: 18px;
color: #ff8a00;
}
.button {
display: flex;
flex-shrink: 0;
max-width: 462px;
padding: 8px 24px 7px;
margin-bottom: 40px;
text-align: center;
color: #ffffff;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
background-color: #ff8a00;
border-radius: 4px;
box-shadow: 0 4px 4px rgba(255, 138, 0, 0.4);
}
.button:hover,
.button:focus {
background-color: #ff9900;
box-shadow: 0 6px 8px rgba(255, 138, 0, 0.4);
}
.button:active {
background-color: #ff8a00;
box-shadow: 0 2px 2px rgba(255, 138, 0, 0.6);
}
.order-list {
width: 100%;
margin: 10px 0 20px;
border-collapse: collapse;
text-align: left;
}
.order-list img {
width: 68px;
height: 52px;
margin-bottom: -5px;
}
.order-list tr {
border-bottom: 1px solid #e2e2e2;
}
.order-list td {
padding: 10px 20px 10px 0;
}
.order-list th:last-child {
width: 140px;
}
.order-list th {
padding: 10px 20px 10px 0;
font-family: "Georgia", "Times", serif;
font-style: italic;
font-weight: 400;
vertical-align: bottom;
}
.order-list td:last-child,
.order-list th:last-child {
padding-right: 0;
}
.contacts-info {
margin: -10px 0 20px;
}
.contacts-info p {
position: relative;
padding-left: 16px;
margin: 12px 0;
}
.contact-phone::before {
position: absolute;
content: "";
width: 10px;
height: 13px;
top: 2px;
left: 0;
background-image: url("img/icon-phone.svg");
}
.contact-address::before {
position: absolute;
content: "";
width: 9px;
height: 13px;
top: 2px;
left: 0;
background-image: url("img/icon-pin.svg");
}
.delivery-background {
display: flex;
flex-shrink: 0;
align-items: center;
margin: 20px 0 20px;
min-height: 200px;
background-image: url("img/delivery-background.jpg");
background-repeat: no-repeat;
background-position: center left;
}
.delivery-text {
width: 210px;
margin-left: auto;
padding: 16px 20px 20px;
background-color: #ffffff;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.delivery-text p {
margin: 8px;
padding: 0;
}
.brands {
padding-top: 20px;
padding-bottom: 4px;
background-color: #f8f8f8;
}
.brands-list {
display: flex;
padding: 0;
margin: 16px -20px 0 0;
flex-wrap: wrap;
list-style: none;
}
.brands-list li {
position: relative;
width: 112px;
margin: 0 20px 16px 0;
padding-top: 58px;
}
.brands-list li::before {
position: absolute;
content: "";
top: 0;
left: 0;
width: 112px;
height: 50px;
background-repeat: no-repeat;
}
.brands-ehm::before {
background-image: url("img/brands-ehm-grey.svg");
}
.brands-cubic::before {
background-image: url("img/brands-cubic-grey.svg");
}
.brands-tehnodom::before {
background-image: url("img/brands-tehnodom-grey.svg");
}
.brands-dg::before {
background-image: url("img/brands-dg-grey.svg");
}
.brands-ehm:hover::before {
background-image: url("img/brands-ehm.svg");
}
.brands-cubic:hover::before {
background-image: url("img/brands-cubic.svg");
}
.brands-tehnodom:hover::before {
background-image: url("img/brands-tehnodom.svg");
}
.brands-dg:hover::before {
background-image: url("img/brands-dg.svg");
}
.features {
padding-top: 20px;
padding-bottom: 10px;
}
.brands-title,
.features-title,
.services-title,
.products-title {
margin: 0;
padding: 0;
font-family: "Georgia", "Times", serif;
font-size: 20px;
line-height: 24px;
font-weight: 400;
}
.features-list {
display: flex;
padding: 0;
margin: 14px 0 0;
justify-content: space-between;
flex-wrap: wrap;
list-style: none;
}
.features-list li {
position: relative;
width: 142px;
margin-bottom: 10px;
}
.features-list li::before {
position: absolute;
content: "";
top: 2px;
left: 0;
}
.feature-unique {
padding-left: 22px;
}
.feature-unique::before {
width: 16px;
height: 12px;
background-image: url("img/feature-unique.svg");
}
.feature-organic {
padding-left: 25px;
}
.feature-organic::before {
width: 19px;
height: 12px;
background-image: url("img/feature-organic.svg");
}
.feature-protected {
padding-left: 16px;
}
.feature-protected::before {
width: 10px;
height: 12px;
background-image: url("img/feature-protected.svg");
}
.site-footer {
background-color: #847462;
}
.site-footer .container {
display: flex;
flex-grow: 1;
justify-content: space-between;
}
.copyright {
margin: auto 0;
flex-shrink: 0;
color: #ffffff;
}
.site-footer .navigation-list {
margin-right: 15px;
margin-left: -15px;
justify-content: left;
}
.copyright + .navigation-list {
justify-content: center;
margin-left: 15px;
}
.site-footer a {
display: block;
margin: 0;
padding: 14px 15px;
color: #ffffff;
}
.social-list {
display: flex;
width: 110px;
padding: 0;
margin: 0 -10px 2px;
justify-content: end;
flex-shrink: 0;
flex-wrap: wrap;
align-items: center;
list-style: none;
}
.social-list a {
display: block;
width: 14px;
height: 14px;
padding: 10px;
background-repeat: no-repeat;
background-position: center;
}
.social-link-twitter {
background-image: url("img/icon-twitter.svg");
}
.social-link-instagram {
background-image: url("img/icon-instagram.svg");
}
.social-link-facebook {
background-image: url("img/icon-facebook.svg");
}
.social-list a:hover,
.social-list a:focus {
opacity: 0.5;
}
.social-list a:active {
opacity: 0.3;
}
.pagination {
display: flex;
flex-wrap: wrap;
margin: 10px -10px -10px 0;
padding: 0;
list-style: none;
}
.pagination a {
display: flex;
padding: 8px 16px;
margin: 0 10px 10px 0;
color: #ff8a00;
border: 1px solid #ff8a00;
border-radius: 4px;
cursor: pointer;
}
.pagination a:focus,
.pagination a:hover {
color: #ffffff;
background-color: #ff8a00;
}
.pagination a:active {
box-shadow: inset 0 2px 10px #c86c00;
}
.pagination a.current {
color: #ffffff;
background-color: #ff8a00;
box-shadow: inset 0 2px 10px #c86c00;
cursor: default;
}
.banner {
display: flex;
justify-content: center;
align-items: center;
height: 96px;
max-width: 100%;
background-color: #FF8A00;
background-image: url("img/bg_img.svg");
background-repeat: no-repeat;
background-size: contain;
background-position: center;
}
.banner p {
width: 380px;
color: #333333;
font-family: "Georgia", "Times", serif;
font-size: 16px;
line-height: 22px;
text-align: center;
}
<!DOCTYPE html><html lang="en" class="no-js"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><script>var b=document.documentElement.classList;b.remove('no-js');if(!window.Promise||!window.sessionStorage||!!sessionStorage.getItem('muller.v2')){b.add('muller')}</script><link rel="dns-prefetch" href="https://assets.htmlacademy.org"><script async src="https://www.googletagmanager.com/gtag/js?id=G-MXPCRXM48C"></script><script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-MXPCRXM48C');
</script><script type="text/javascript">
(function(e,t){var n=e.amplitude||{_q:[],_iq:{}};var r=t.createElement("script")
;r.type="text/javascript"
;r.integrity="sha384-d/yhnowERvm+7eCU79T/bYjOiMmq4F11ElWYLmt0ktvYEVgqLDazh4+gW9CKMpYW"
;r.crossOrigin="anonymous";r.async=true
;r.src="https://cdn.amplitude.com/libs/amplitude-5.2.2-min.gz.js"
;r.onload=function(){if(!e.amplitude.runQueuedFunctions){
console.log("[Amplitude] Error: could not load SDK")}}
;var i=t.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)
;function s(e,t){e.prototype[t]=function(){
this._q.push([t].concat(Array.prototype.slice.call(arguments,0)));return this}}
var o=function(){this._q=[];return this}
;var a=["add","append","clearAll","prepend","set","setOnce","unset"]
;for(var u=0;u<a.length;u++){s(o,a[u])}n.Identify=o;var c=function(){this._q=[]
;return this}
;var l=["setProductId","setQuantity","setPrice","setRevenueType","setEventProperties"]
;for(var p=0;p<l.length;p++){s(c,l[p])}n.Revenue=c
;var d=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties","identify","clearUserProperties","setGroup","logRevenueV2","regenerateDeviceId","groupIdentify","onInit","logEventWithTimestamp","logEventWithGroups","setSessionId","resetSessionId"]
;function v(e){function t(t){e[t]=function(){
e._q.push([t].concat(Array.prototype.slice.call(arguments,0)))}}
for(var n=0;n<d.length;n++){t(d[n])}}v(n);n.getInstance=function(e){
e=(!e||e.length===0?"$default_instance":e).toLowerCase()
;if(!n._iq.hasOwnProperty(e)){n._iq[e]={_q:[]};v(n._iq[e])}return n._iq[e]}
;e.amplitude=n})(window,document);
amplitude.getInstance().init("df11525b6880a3c5e2af14f9b6238408", null,{
includeUtm: true,
includeGclid: true,
includeReferrer: true,
deviceIdFromUrlParam: true
}, function (instance) {
window.amplitudeLoaded = true;
});
</script><link rel="stylesheet" href="https://assets.htmlacademy.org/css/core.v284.css"><link rel="stylesheet" href="https://assets.htmlacademy.org/css/profile.v236.css"><link rel="stylesheet" href="https://assets.htmlacademy.org/css/course.v246.css"><link rel="stylesheet" href="https://assets.htmlacademy.org/css/course-interface-light.v20.css"><link rel="stylesheet" href="https://assets.htmlacademy.org/css/course-interface-en.v2.css"><script src="https://assets.htmlacademy.org/js/sentry.js" data-sentry="3774884cc81746ed84c0ba7c5cd4ac7b" data-project="26" data-version="2"></script><link rel="stylesheet" href="/css/custom.css"><link rel="stylesheet" href="/css/cookies.css"><link rel="preload" as="script" href="https://assets.htmlacademy.org/js/general.v274.js"><title>The date function — Numbers and strings in PHP — HTML Academy</title><meta name="csrf-token" content="67764caf322823086fca37a7326b9bd2a54"><meta property="og:type" content="website"><meta property="og:site_name" content="HTML Academy"><meta name="twitter:url" property="og:url" content="https://htmlacademy.org"><meta name="twitter:title" property="og:title" content="Interactive online courses HTML Academy"><meta name="twitter:description" property="og:description" content="Together we’ll learn how to work with real code, solve true-to-life problems, use cutting edge technologies. Minimum of boring theory and lots of practical tasks."><meta name="twitter:image" property="og:image" content="https://htmlacademy.org/og/htmlacademy.png"><meta name="twitter:card" content="summary_large_image"><link rel="canonical" href="https://htmlacademy.org/courses/php-basics/php-numbers-strings/date-function"><meta name="theme-color" content="#2f358f"></head><body class="course-interface course-interface--light" data-base="/assets/courses/34/"><header class="page-header page-header--course"><div class="page-header__inner"><div class="page-header__top"><a class="page-header__logo" href="/" aria-label="HTML Academy Home"><img src="https://assets.htmlacademy.org/img/logo--small.svg?cs=1218aec0be4a5f23db79ad29a14e30f7f9fb9a25" width="24" height="36" alt="HTML Academy"></a><nav class="main-nav main-nav--mini" role="navigation"><div class="main-nav__course-nav"><a class="main-nav__course-item main-nav__course-button main-nav__course-button--prev" href="/courses/php-basics/php-numbers-strings/current-page-link">Highlighting the link to the current page</a><div class="main-nav__course-item main-nav__course-list main-nav__course-list--collapsed"><b class="main-nav__course-title">Numbers and strings in PHP</b><span class="main-nav__course-stat">12/15</span><div class="main-nav__course-contents"><a class="main-nav__course-contents-link" href="/courses/php-basics/php-numbers-strings">Back to the list of tasks</a><ul class="main-nav__course-contents-list"><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/pagination">1. Creating pagination in the catalog</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/offset">2. Calculating the offset</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/intval-function">3. The intval function</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/shorthand-ternary-operator">4. The shorthand ternary operator ?:</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/for-loop">5. The for loop</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/embed-loop">6. Embedding the for loop in the template</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/add-href">7. Adding an address to the href attribute</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/count-pages">8. Counting the number of catalog pages</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/ceil-function">9. The ceil function</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/ternary-operator">10. The ternary operator ?:</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/current-page-link">11. Highlighting the link to the current page</a></li><li class="main-nav__course-contents-item main-nav__course-contents-item--current"><a href="/courses/php-basics/php-numbers-strings/date-function">12. The date function</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/change-date-format">13. Changing the date format</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/use-double-quotes">14. Using double quotes</a></li><li class="main-nav__course-contents-item"><a href="/courses/php-basics/php-numbers-strings/summary">15. Summary of “Numbers and Strings in PHP”</a></li></ul></div></div><a class="main-nav__course-item main-nav__course-button main-nav__course-button--next" href="/courses/php-basics/php-numbers-strings/change-date-format">Changing the date format</a></div><ul class="main-nav__list main-nav__list--user main-nav__list--user-guest"><li class="main-nav__item" itemprop="name"><a class="main-nav__link" href="/signup?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-numbers-strings%2Fdate-function" title="Sign up" data-modal="open" data-value="register" itemprop="url"><span class="main-nav__icon" aria-hidden="true"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#user"></use></svg></span>Sign up</a></li><li class="main-nav__item main-nav__item--login" itemprop="name"><a class="main-nav__link" href="/login?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-numbers-strings%2Fdate-function" title="Log in" data-modal="open" data-value="login" itemprop="url"><span class="main-nav__icon" aria-hidden="true"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#login"></use></svg></span>Log in</a></li></ul></nav></div></div></header><div class="notice notice--error js--initialization-error hidden"><a class="notice__link" href="#"><span class="notice__title js--initialization-error__content"></span></a><button class="notice__close" type="button">Close</button></div><main class="course-container course-interface__content task"><div class="course-container__inner"><article class="course-layout js--user-settings" data-theme="ace/theme/ha-light-default" data-taskid="677" data-storageKey="task-677"><div class="course-loading-overlay course-layout__loading-overlay hidden"><div class="course-loading-overlay__inner"><span class="course-loading-overlay__image"><svg width="70" height="70" viewBox="0 0 70 70" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="clip-path" transform="translate(-3.2 -3.22)"><circle cx="38.65" cy="38.78" r="34.15" fill="#d5dcf1" stroke-dasharray="0"/></clipPath></defs><style>.keks-loader-circle { stroke-dasharray: 500; stroke-dashoffset: 1000; animation: dash 1.5s linear reverse infinite; } @keyframes dash { 0% { stroke-dashoffset: 0; }, 25% { stroke-dashoffset: 1000; }, 50% { stroke-dashoffset: 0; }, 75% { stroke-dashoffset: 1000; }, 100% { stroke-dashoffset: 0; } }</style><circle cx="35" cy="33" r="33" transform="matrix(.01053 -.96378 .9652 .01054 2.506 68.344)" fill="#D5DCF1" stroke="#F15A29" stroke-width="3.5"/><g transform="matrix(.9237 -.01338 0 .98374 2.38 -2.91)" clip-path="url(#clip-path)"><path d="M55.25 62.93c-1-2.23-2.81-5-4-7.27-.87-1.58-.39-3.35-2.32-3.16 0 0-2.81.84-3.88 1-1.07.16-4.65 3-5.91 3.44-1.55.56-3.29.19-4.93.19-1.686-.555-3.333-1.223-4.93-2-1-.74-7.26-2.32-7.45-1.77-.19.55-6.03 13.66-5.58 14.23.29.28 15 8.57 15.78 8.75 1.113.666 2.188 1.394 3.22 2.18.48.56 12.47-6 12.47-6.93 0 0 7.944-4.177 8.52-4.38 2.1-.74 2.804-.31-1-4.28h.01z" fill="#CF4A27"/><path d="M41.56 55.18c-.57-.47-1.06.46-.29 1 3.19 2.37 5.86 5.87 6.17 9.84-1.69-.58-3.44-.73-5.11-1.37a.53.53 0 0 0-.77.56 16.56 16.56 0 0 1-.07 4.57 12 12 0 0 1-4.29-2.88c-.29-.36-.87 0-.87.38-.17 1.7-.06 3.25-.9 4.72l-.15.15-.17-.17c-.82-1.46-.71-3-.88-4.68 0-.38-.59-.74-.87-.38a12.11 12.11 0 0 1-4.29 2.86 16.56 16.56 0 0 1-.07-4.56.53.53 0 0 0-.77-.56c-1.67.64-3.42.8-5.11 1.37.31-4 3-7.48 6.17-9.84.77-.56.29-1.49-.29-1-3.77 2.7-6.68 6.8-6.77 11.46a.51.51 0 0 0 .77.46c1.55-.71 3.33-.82 5-1.35-.15 1.61.13 3.14.13 4.79a.54.54 0 0 0 .77.46 21.65 21.65 0 0 0 4.47-2.6 9.28 9.28 0 0 0 1.09 4.37 2.32 2.32 0 0 0 .43.62l.1.06h.07a.59.59 0 0 0 .61-.1 2.1 2.1 0 0 0 .47-.72 9.49 9.49 0 0 0 1-4.31 22.19 22.19 0 0 0 4.48 2.6.54.54 0 0 0 .77-.46c0-1.65.28-3.17.13-4.79 1.68.53 3.45.64 5 1.35a.51.51 0 0 0 .77-.46c-.11-4.67-3-8.77-6.79-11.47z" fill="#F1662A"/><path d="M35.49 62.47s5-.38 6-1.49c4.65-5.4 9.1-6.7 9.1-6.7l-.68-1.39-14.53 2.8-13.37-2.7v1.49s3.49 1.21 8.24 6.61c1 1.1 5.14 1.38 5.24 1.38" style="isolation:isolate" fill="#A23922" opacity=".5"/><path d="M22.12 52.88c-1.75 5.5-5.33 8.66-6 14.34" fill="#F1662A"/><path d="M21.54 52.78c-1.64 5-5.33 9.12-6 14.43-.09.65.64 2 1.07 0 .68-5.21 4.45-9.31 6-14.16.19-.64-.87-.91-1.07-.27zm28.08.55c2 4.57 5.13 8.57 6.4 13.4.2.65 1.4.35 1.31-.29-1.25-4.93-4.7-9-6.83-13.67-.2-.55-1.17-.08-.88.57z" fill="#151841"/></g><circle class="keks-loader-circle" cx="35" cy="33" r="33" transform="matrix(.01053 -.96378 .9652 .01054 2.506 68.344)" fill="#D5DCF1" stroke-width="3.5" fill-opacity="0" stroke="#2A2F5A"/><path d="M54.838 32.26c-.084 4.648-.716 9.52-3.152 13.594-1.08 1.86-1.525 3.2-3.246 4.5-1.44 1.042-4.65.428-7.03 2.334 0 0-3.245 2.79-6.034 2.604-2.79-.186-5.403-2.427-5.403-2.427-1.348-1.293-4.584-1.562-6.574-2.25-2.344-.865-6.036-8.053-6.296-9.3l-.633-2.426c-.808-1.86-.994-3.98-1.98-5.887-.673-1.056-1.178-2.21-1.496-3.422-.55-2.603-1.163-5.28-1.628-7.875-.81-3.896-2.427-10.23.186-13.502 0 0 2.94-.67 8.192 4.845 2.52 2.25 5.04 6.51 8.193 7.7.62-.678 1.18-1.41 1.673-2.186.86.79 1.986 1.22 3.153 1.21.716 0 1.264-.69 1.794-.69.46.105.912.248 1.35.428 1.858.78 1.793-.864 2.872-.78 1.078.083 1.078 2.073 3.42.78l1.163-.018c2.976-3.115 8.908-11.084 13.948-9.96 4.502 1.126-.808 18.533-2.342 22.773" fill="#F15A29"/><path d="M59.422 11.486c-.93-3.72-5.216-2.334-7.56-.782-2.037 1.452-3.884 3.155-5.495 5.068-.716.78-1.442 1.646-2.25 2.51l-.93 1.042c-.312 0-.624.027-.93.084-.633.084-1.08.605-1.71.353-.35-.208-.664-.472-.93-.78-.554-.41-1.308-.41-1.86 0-.304.488-.882.73-1.442.605-.527-.242-1.07-.444-1.627-.605-.484-.003-.956.147-1.35.428-1.077.688-2.52-.26-3.328-.865-.246-.2-.608-.162-.81.084-.395.632-.84 1.232-1.328 1.795-2.427-1.21-4.138-3.47-5.766-5.45-1.53-1.704-3.177-3.3-4.928-4.78-.823-.765-1.765-1.394-2.79-1.86-.862-.325-1.788-.446-2.706-.352-.81 0-1.162 1.21-1.44 1.86-.434 1.19-.648 2.45-.633 3.72.097 2.626.46 5.237 1.077 7.792.363 1.562.55 3.198.93 4.76.243 1.77.667 3.507 1.265 5.19.812 1.57 1.532 3.19 2.157 4.844.362 1.21.808 2.427 1.078 3.636.312 1.247.735 2.464 1.265 3.635 1.11 2.42 2.566 4.667 4.323 6.668 1.71 1.86 4.585 1.47 6.75 2.51 2.075 1.47 4.325 2.94 6.845 3.292 2.52.353 5.04-1.562 7.208-3.2 1.71-.78 3.608-.78 5.402-1.384 1.795-.605 2.79-2.604 3.608-4.073 1.27-2.134 2.238-4.434 2.874-6.835.503-2.078.79-4.204.855-6.34.05-.433.125-.86.223-1.285 1.22-3.304 2.213-6.687 2.976-10.126.827-3.72 1.813-7.71 1.004-11.158zm-.93 4.584c-.225 2.128-.586 4.24-1.078 6.323-.71 3.194-1.602 6.345-2.67 9.438-.262.617-.407 1.276-.427 1.945-.092 1.935-.34 3.86-.744 5.756-.58 2.34-1.49 4.585-2.706 6.668-.93 1.646-1.794 3.636-3.868 4.156-.93.26-1.796.354-2.614.52.007-.335-.352-.553-.647-.392-.022.012-.042.025-.06.04-.91.582-1.78 1.22-2.614 1.906-1.71 1.21-3.607 2.334-5.672 2.25-1.535-.203-2.994-.792-4.24-1.71-.363-.177-1.44-1.042-1.627-1.126-.716-.52-1.35-.93-2.074-1.47-.363-.26-.716.085-.716.522-.716-.177-1.348-.26-1.98-.428-1.86-.428-2.874-1.86-3.962-3.376-1.68-2.457-2.94-5.18-3.72-8.052-.27-.93-.632-1.86-.93-2.94-.31-1.408-.862-2.754-1.626-3.98-.773-1.45-1.29-3.022-1.526-4.648-.363-1.562-.716-3.2-.995-4.845-.448-2.426-.996-4.76-1.266-7.27-.186-2.158-.186-4.585 1.08-6.51.57-.054 1.146-.026 1.71.083.9.318 1.727.818 2.427 1.47 1.265.93 2.344 2.073 3.506 3.115 2.706 2.334 5.496 7.44 8.555 7.97.693-.605 1.297-1.303 1.796-2.075.79.56 1.707.908 2.668 1.014.508.065 1.022-.06 1.442-.354.54-.408 1.295-.373 1.794.084.67.408 1.52.375 2.158-.084.25-.282.57-.49.93-.604.344.18.657.412.93.688.59.452 1.366.584 2.073.353.447-.083.633-.26 1.08-.353.32.042.646-.02.93-.177 1.525-1.646 2.975-3.375 4.5-4.937 1.676-1.96 3.766-3.527 6.12-4.585 1.44-.604 3.328-.78 3.96.865.428 1.55.486 3.177.167 4.752z" fill="#151841"/><path d="M48.524 33.04c-.236-.845-.932-1.483-1.795-1.646-.705-.074-1.413-.102-2.12-.083.083-.604.548-2.51-.81-2.333-.716 0-1.44 2.073-1.86 2.603-.715 1.042-1.162.78-1.264-.428-.102-1.208.446-2.854-.55-3.115-.715-.083-1.263 1.293-1.524 2.158-.083.427-.548.78-.362-2.25 0-.782 0-2.855-.447-2.94h-.186c-1.264.085-2.157 4.94-2.52 6.324-.27-1.386-1.71-7.273-2.79-5.98-.14.61-.202 1.234-.185 1.86 0 .427-.084 3.375-.447 2.854-.186-.864-1.162-2.603-1.71-2.334-.995.865-.187 2.074-.447 3.292s-.632 1.47-1.264.354c-.363-.52-.995-2.604-1.71-2.688-1.266-.176-.93 1.73-.93 2.334-.69-.076-1.383-.104-2.075-.083-.852.156-1.558.75-1.86 1.56-.084.177 0 6.668 5.95 6.76.862.043 1.72-.103 2.52-.427.52-.13.995-.558 1.45-.214l6.11.4c.342-.36.847-.51 1.33-.4.925.493 1.934.808 2.976.93 3.06 0 5.765-1.21 6.667-3.98.307-.103-.056-2.353-.15-2.53z" fill="#EFA75B"/><path d="M23.67 33.998s3.783-.354 4.77.177c1.095.612 1.896 1.642 2.22 2.854-.492.19-1.003.333-1.524.427-.616.09-1.237.15-1.86.177-3.06-.354-3.607-3.636-3.607-3.636zm23.6.51s-3.72-.52-4.772-.082c-1.16.554-2.038 1.564-2.426 2.79l1.44.52c.604.18 1.23.266 1.86.26 3.18-.195 3.897-3.487 3.897-3.487zm-7.03 2.605c.27.084 1.16.428 1.44.52.53.155 1.076.242 1.627.26h.186c2.706-.083 3.608-2.854 3.72-3.29-1.053-.157-2.116-.235-3.18-.233-.487-.017-.973.042-1.442.176-1.128.46-1.992 1.402-2.35 2.567z" fill="#FFF"/><path d="M32.223 43.26c-.152-1.397-.03-2.81.363-4.157 0 0 .93-2.94 2.343-3.2 3.72-.687 4.054 7.44 4.054 7.44-4.334 1.906-6.76-.084-6.76-.084z" fill="#F47741"/><path d="M45.204 44.292c-.508-.698-1.296-1.14-2.157-1.21-1.71-.176-7.56 1.126-7.56 1.126v.065c-.772-.205-5.98-1.6-7.56-1.45-.875.04-1.692.45-2.25 1.125-.446.864.084 2 .55 2.938.74 1.35 1.788 2.505 3.058 3.375.48.332 1.045.513 1.627.522 4.492.084 4.77-2.585 4.77-2.464l.075-.465c.186 0-.363 2.79 4.054 2.79.542.102 1.1.073 1.628-.084 1.305-.853 2.39-2 3.17-3.35.41-.92 1.043-1.96.596-2.918z" fill="#EFA75B"/><path d="M31.963 50.968c-.197-.004-.358-.157-.372-.353-.018-.207.158-.378.364-.354 3.245-.26 3.505-2.156 3.608-2.25-.006-.19.183-.325.362-.26.193.01.35.16.363.354 0 .084 0 1.906 3.422 2 .192.008.348.16.362.353-.018.19-.172.34-.363.353-1.352.11-2.68-.4-3.61-1.386-.095-.096-.16-.22-.185-.353-.982 1.174-2.423 1.866-3.952 1.898z" fill="#151841"/><path d="M32.14 43.427c.186-.52 3.608.083 3.608.083s2.975-.688 3.422.084c-.05.288-.175.557-.363.78-.515-.056-1.037.004-1.525.178-.333.61-.488 1.304-.446 2-.222.394-.574.7-.995.864-.398-.112-.75-.354-.994-.688.047-.75-.146-1.496-.55-2.13-.27-.26-1.264.084-1.626-.083l-.53-1.088zm6.89.242c-.05.286-.175.556-.363.78-.503-.063-1.015-.012-1.497.148-.333.612-.487 1.305-.446 2-.222.394-.574.7-.995.864-.4-.112-.75-.354-.996-.688.053-.76-.14-1.515-.55-2.157-.268-.26-1.263.084-1.626-.084-.26-.23-.45-.53-.55-.864" fill="#CF4A27"/><path d="M35.748 47.853c-.587-.226-1.072-.655-1.367-1.21-.022-.634-.144-1.262-.362-1.86h-.567c-.31.073-.636.043-.93-.082-.35-.253-.61-.616-.734-1.03-.082-.17.006-.374.186-.43.172-.083.38 0 .447.177.056.278.215.524.445.69h.586c.37-.086.757-.023 1.08.175.413.585.634 1.284.632 2v.353c.185.177.4.32.632.428.22-.18.42-.382.595-.605-.004-.29.024-.58.083-.865.026-.48.22-.94.55-1.292.506-.235 1.07-.325 1.626-.26.077-.108.14-.227.185-.353-.038-.148.042-.3.186-.353.145-.11.352-.07.447.083.084.084.27.428-.446 1.21-.083.083-.185.176-.27.083-.422-.033-.848-.004-1.264.084-.215.502-.323 1.043-.316 1.59v.176c-.326.57-.824 1.023-1.422 1.293zm-7.198-14.04c-.788-.226-1.61-.314-2.427-.26-1.264 0-2.436.082-2.52.082h-.38v.354s.715 3.55 3.96 3.895c.693.006 1.385-.025 2.074-.093.27-.084 1.71-.428 1.71-.428-.025-1.56-.975-2.956-2.417-3.552zm.53 3.207c-.558.142-1.135.2-1.71.177-1.14-.075-2.16-.728-2.707-1.73-.247-.37-.432-.78-.548-1.21.455 0 1.18-.092 2.073-.175h.596c-.084.688-.242 2.464.483 2.334.725-.13.837-1.46.93-2.13h.112c.937.492 1.647 1.33 1.98 2.334-.388.176-.793.31-1.21.4zm18.365-2.864c-1.104-.145-2.215-.232-3.33-.26-.546-.01-1.093.05-1.626.176-1.166.483-2.08 1.425-2.53 2.604l-.158.79 1.795.623c.558.153 1.132.24 1.71.26h.28c3.245-.177 4.137-3.72 4.137-3.72l.084-.353zm-1.264 1.86c-.54 1.394-2.882 1.646-2.966 1.646-.517-.02-1.03-.11-1.525-.26-.186-.085-.633-.26-1.08-.43.374-.966 1.117-1.746 2.065-2.165 0 .68.158 1.953.81 2.083.65.13.613-1.535.566-2.26.934.005 1.865.064 2.79.177-.11.316-.473.65-.66 1.17z" fill="#151841"/><path d="M19.26 39.27c.535 1.362 1.56 2.473 2.874 3.115.534.312 1.204-.07 1.207-.69.002-.285-.15-.55-.397-.695-.918-.46-1.65-1.222-2.073-2.158-.344-.957-1.972-.52-1.61.428zm29.45 3.125c1.083-.59 2.01-1.428 2.706-2.446.3-.556-.112-1.228-.743-1.21-.293.007-.56.17-.698.428-.568.776-1.306 1.412-2.158 1.86-.394.23-.517.742-.27 1.125.263.376.773.482 1.163.242z" fill="#EFA75B" stroke-width="13"/><path d="M16.025 32.436c1.525-1.386 2.427-4.408 2.79-6.835-.084.354 2.613.43 4.138-1.208 1.078-1.125.446-2-.186-3.375-1.71-3.552-4.585-6.323-7.384-8.918-.716-.69-1.44-2.428-2.706-2-.995.353-.93 3.2-.716 4.073 1.09 7.448 4.065 18.263 4.065 18.263zm37.372-.78c-1.704-1.826-2.822-4.12-3.208-6.585 0 .354-2.614.354-4.056-1.29-.995-1.127-.362-1.86.363-3.117 1.86-3.198 4.863-5.718 7.746-8.136.81-.604 1.627-1.47 2.79-.93.994.428.715 2.334.548 3.115-1.083 5.72-2.48 11.376-4.183 16.943z" fill="#FFF"/><path d="M53.564 20.422c-1.98.51-4.138 1.636-5.105 3.487-.43-2.196 1.645-4.65 3.393-5.832.333-.21.312-.703-.037-.886-.162-.085-.357-.076-.512.022-2.157 1.562-4.417 4.5-3.784 7.188.076.262.354.41.614.325l-.075.28c-.085.603.93.864.994.26.446-2.158 2.706-3.376 4.77-3.897.372-.076.522-.526.27-.81-.133-.15-.342-.204-.53-.138zM17.457 18.06c-.55-.354-.995.428-.55.865 1.433 1.004 3.182 3.05 3.395 4.956-.93-1.86-3.05-2.975-5.105-3.486-.386-.005-.633.41-.445.747.042.076.103.14.176.184 2.073.52 4.324 1.73 4.77 3.896.106.328.5.46.78.26.273.192.653.06.745-.26.735-2.66-1.6-5.728-3.766-7.16z" fill="#F1662A"/></svg></span><p class="course-loading-overlay__message"><b class="course-loading-overlay__message-title">Loading…</b><br><span class="course-loading-overlay__message-text">Everything will be ready in few seconds</span></p></div></div><div class="course-layout__sidebar course-theory"><div class="course-theory__inner course-theory__inner--left-stub"><button class="course-theory__close icon-close icon-close--light" type="button">Close</button><ul class="course-tabs course-tabs--non-interactive course-layout__theory-heading js--theory-tabs"><li class="course-tabs__item course-tabs__item--external course-tab course-tab--centered"><span class="course-tab__icon"><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#icon-theory"></use></svg></span><span class="course-tab__title">Theory</span></li><li class="course-tabs__item course-tabs__item--internal course-tab course-tab--centered course-tab--active js--theory-tab__theory"><span class="course-tab__icon"><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#icon-theory"></use></svg></span><span class="course-tab__title">Theory</span></li><li class="course-tabs__item course-tabs__item--internal course-tab course-tab--centered js--theory-tab__comments"><span class="course-tab__icon"><svg aria-hidden="true" style="width: 16px; height: 16px; fill: #2e2c9c;"><use xlink:href="/img/sprites/up.svg#comment"></use></svg></span><span class="course-tab__title">Comments</span></li></ul><section class="course-theory__content"><div class="js--theory-pane__theory course-theory__content-inner"><h1 class="course-theory__content-heading">The date function</h1><div class="course-theory__content-text"><p>We created pagination for the catalog, but Muffin thinks that this is not enough. He is convinced that we can boost sales by adding a flashy banner to the page.</p><style>
.banner {
display: flex;
justify-content: center;
align-items: center;
height: 96px;
width: 100%;
background-color: #FF8A00;
background-image: url("/assets/courses/34/img/bg_img.svg");
background-repeat: no-repeat;
background-size: contain;
background-position: center;
}
.banner p {
width: 380px;
text-align: center;
color: #333333;
font-size: 16px;
line-height: 22px;
font-family: Georgia, "Times", serif;
}
</style><section class="banner"><p>Marketers have declared that 01/01/1970 is the best time to shop!</p></section><p>The date that is displayed inside the banner must be today’s date. We can change the template every day exactly as midnight… But the better solution would be to use the built-in <code>date</code> function.</p><p>This function accepts a template string, and it returns the date in the specified format.</p><pre><code>$now = <mark>date</mark>('H:i:s d.m.Y');
muffin_log($now); // Outputs: "<span class="example">13:54:48 23.06.2020</span>"</code></pre><p>The date format is specified in the template string using control characters. Here are a few of them:</p><table class="table table--bordered" style="text-align: center;"><thead><tr><th style="text-align: center;">Character</th><th style="text-align: center;">Value</th></tr></thead><tbody><tr><td>d</td><td>Day of the month, two digits with leading zeros</td></tr><tr><td>j</td><td>Day of the month with a leading zero</td></tr><tr><td>F</td><td>Full name of the month (in English)</td></tr><tr><td>m</td><td>Sequential number of the month with a leading zero</td></tr><tr><td>n</td><td>Sequential number of the month without a leading zero</td></tr><tr><td>Y</td><td>Sequential number of the year, four digits</td></tr><tr><td>y</td><td>Number of the year, two digits</td></tr><tr><td>H</td><td>Hours in 24-hour format with a leading zero</td></tr><tr><td>i</td><td>Minutes with a leading zero</td></tr><tr><td>s</td><td>Seconds with a leading zero</td></tr></tbody></table><p>You can find a complete list of characters in the <a href="https://www.php.net/manual/en/function.date.php" target="_blank" rel="nofollow noopener">documentation</a>.</p><p>The function returns the characters that are not control characters unchanged. Therefore, we can use spaces, dots, and the like in the template string.</p><p>We use the <code>date</code> function to output today’s date inside the banner. The web designer has already prepared everything, and Dumpo copied the <code>date</code> function call from another project. The date that the function returns is stored in the <code>$today</code> variable:</p><pre><code>$today = date('j F y');</code></pre><p>We will output the date inside the banner using the <code>$today</code> variable. Let’s take a look at the format it will be displayed in, and, if necessary, change it.</p><div class="info info--frame-heading info--frame-heading--bytheway info--green"><p>By default, the <code>date</code> function returns the time of the time zone specified in the PHP settings on the server. The time zone can be changed from the script using the <code class="nowrap">date_default_timezone_set</code> function. You can read more details in the <a href="https://www.php.net/manual/en/function.date-default-timezone-set.php" target="_blank" rel="nofollow noopener">documentation</a>.</p></div><script>
const pad = (num) => num < 10 ? `0${num}` : num;
const example = document.querySelector('.example');
const now = new Date();
const hours = pad(now.getHours());
const minutes = pad(now.getMinutes());
const seconds = pad(now.getSeconds());
const day = pad(now.getDate());
const month = pad(now.getMonth() + 1);
const year = now.getFullYear();
example.textContent = `${hours}:${minutes}:${seconds} ${day}.${month}.${year}`;
</script></div></div><div class="js--theory-pane__comments hidden course-theory__content-inner"><div class="course-theory__content-text"><h2 class="course-theory__content-heading">Comments</h2><div id="disqus_thread"></div><script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables */
var disqus_config = function () {
this.page.url = "https://htmlacademy.org/courses/php-basics/php-numbers-strings/date-function";
this.page.identifier = "task-677";
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://htmlacademy.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script><noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript></div></div></section><div class="course-theory__controls"><button class="button button--close" type="button">To the task</button></div></div></div><div class="course-layout__column course-layout__column--left"><div class="js--course-tabs course-tabs course-tabs--left course-layout__course-tabs-wrapper"><div class="course-tabs__item course-tabs__files-tab course-tab js--editor-tab js--editor-files-tab"><span class="course-tab__icon"><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#files"></use></svg></span><span class="course-tab__title">Files</span></div><div class="course-tabs__scroller-wrapper"><button class="hidden course-tabs__button-scroll course-tabs__button-scroll--left js--course-tabs-btn-scroll-left"><span class="sr-only">To the left</span><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#arrow-right"></use></svg></button><div class="js--course-tabs-scroller course-tabs__scroller course-layout__course-tabs course-layout__course-tabs--scroller"><ul class="js--course-tabs-list course-tabs__list"></ul></div><button class="hidden course-tabs__button-scroll course-tabs__button-scroll--right js--course-tabs-btn-scroll-right"><span class="sr-only">To the right</span><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#arrow-right"></use></svg></button></div></div><div class="js--files hidden"><div
class="js--file"
data-visible="true"
data-active="false"
data-enabled="true"
data-title="catalog.php"
data-mode="php"
data-src="catalog.php"
data-selection="[13,14,13,21]"
data-scroll-to=""
data-left-url-part="catalog.php"
data-right-url-part=""
data-right-url-part-active="false"
data-browser-tab="true"
data-browser-tab-name=""
data-browser-tab-active="true"
data-browser-scroll=""><?php
require('products_db.php');
$products = get_products();
$limit = 6;
$page = intval($_GET['page']) ?: 1;
$offset = ($page - 1) * $limit;
$products_on_page = array_slice($products, $offset, $limit, true);
$products_quantity = count($products);
$pages = $products_quantity / $limit;
$pages_total = ceil($pages);
$today = date('j F y');
require('components/header.php');
require('components/products_list.php');
require('components/footer.php');
</div><div
class="js--file"
data-visible="false"
data-active="false"
data-enabled="false"
data-title="footer.php"
data-mode="php"
data-src="components/footer.php"
data-selection=""
data-scroll-to=""
data-left-url-part=""
data-right-url-part=""
data-right-url-part-active="false"
data-browser-tab="false"
data-browser-tab-name=""
data-browser-tab-active="false"
data-browser-scroll=""><footer class="site-footer">
<div class="container">
<p class="copyright">© Muffin, 2019</p>
<ul class="navigation-list">
<li><a href="catalog.php">Catalog</a></li>
<li><a href="delivery.php">Delivery</a></li>
<li><a href="cart.php">Cart</a></li>
</ul>
<ul class="social-list">
<li>
<a class="social-link-twitter" href="https://twitter.com">
<span class="visually-hidden">Twitter</span>
</a>
</li>
<li>
<a class="social-link-instagram" href="https://instagram.com">
<span class="visually-hidden">Instagram</span>
</a>
</li>
<li>
<a class="social-link-facebook" href="https://facebook.com">
<span class="visually-hidden">Facebook</span>
</a>
</li>
</ul>
</div>
</footer>
</body>
</html>
</div><div
class="js--file"
data-visible="false"
data-active="false"
data-enabled="false"
data-title="header.php"
data-mode="php"
data-src="components/header.php"
data-selection=""
data-scroll-to=""
data-left-url-part=""
data-right-url-part=""
data-right-url-part-active="false"
data-browser-tab="false"
data-browser-tab-name=""
data-browser-tab-active="false"
data-browser-scroll=""><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Online store for home furnishings</title>
<link href="style.css" rel="stylesheet">
</head>
<body>
<header class="site-header">
<nav class="site-navigation">
<a class="logo-link" href="index.php">
<img src="img/logo-full.svg" width="62" height="17" alt="Gloevk store logo">
</a>
<ul class="navigation-list">
<li><a href="catalog.php">Catalog</a></li>
<li><a href="delivery.php">Delivery</a></li>
<li><a href="cart.php">Cart</a></li>
</ul>
</nav>
</header>
</div><div
class="js--file"
data-visible="true"
data-active="true"
data-enabled="true"
data-title="products_list.php"
data-mode="php"
data-src="components/products_list.php"
data-selection="[2,34,2,44]"
data-scroll-to=""
data-left-url-part=""
data-right-url-part=""
data-right-url-part-active="false"
data-browser-tab="false"
data-browser-tab-name=""
data-browser-tab-active="false"
data-browser-scroll=""><section class="banner">
<p>Marketers have declared that 01/01/1970 is the best time to shop!</p>
</section>
<section class="catalog">
<div class="container">
<h1 class="catalog-title">Product catalog</h1>
<ol class="pagination">
<?php for ($i = 1; $i <= $pages_total; $i = $i + 1): ?>
<li>
<a href="catalog.php?page=<?= $i ?>" class="<?= $i === $page ? 'current' : '' ?>"><?= $i ?></a>
</li>
<?php endfor; ?>
</ol>
<ul class="products-list">
<?php foreach($products_on_page as $i => $item): ?>
<li>
<a class="product-card" href="product.php?product_id=<?= $i ?>">
<h3><?= $item['title'] ?></h3>
<img src="<?= $item['img_url'] ?>" width="156" height="120" alt="<?= $item['title'] ?>">
<div class="product-options">
<span class="price"><?= $item['price'] ?></span>
<ul class="colors-list">
<?php foreach ($item['colors'] as $color): ?>
<li class="color-<?= $color ?>"></li>
<?php endforeach;?>
</ul>
</div>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</section>
</div><div
class="js--file"
data-visible="false"
data-active="false"
data-enabled="false"
data-title="products_db.php"
data-mode="php"
data-src="products_db.php"
data-selection=""
data-scroll-to=""
data-left-url-part=""
data-right-url-part=""
data-right-url-part-active="false"
data-browser-tab="false"
data-browser-tab-name=""
data-browser-tab-active="false"
data-browser-scroll=""><?php
function get_products() {
return [
'1' => [
'title' => 'Asusmer hanging bed',
'img_url' => 'img/item-asusmer.jpg',
'price' => 10000,
'discount' => 1000,
'is_new' => true,
'is_last' => false,
'type' => 'furniture',
'colors' => ['blue'],
'features' => ['Pleases cats', 'Inspires envy', 'Hangs firmly', 'Soft', 'Stylish', 'Yours', 'Doesn’t swing like a baby’s cradle', 'Waits for you at home']
],
'2' => [
'title' => 'Badeta armchair',
'img_url' => 'img/item-badeta.jpg',
'price' => 3500,
'discount' => 0,
'is_new' => false,
'is_last' => false,
'type' => 'furniture',
'colors' => ['blue', 'black'],
'features' => ['Shakes the apartment', 'Cozy', 'Hangs firmly', 'It’s just as if grandma knitted it']
],
'3' => [
'title' => 'Blempere stickers',
'img_url' => 'img/item-blempere.jpg',
'price' => 500,
'discount' => 0,
'is_new' => false,
'is_last' => true,
'type' => 'other',
'colors' => ['blue', 'black', 'red'],
'features' => ['Adhere permanently', 'Bright', 'Funny', 'Stylish', 'Do not launder']
],
'4' => [
'title' => 'Bletub chandelier',
'img_url' => 'img/item-bletub.jpg',
'price' => 4000,
'discount' => 0,
'is_new' => true,
'is_last' => true,
'type' => 'lighting',
'colors' => ['red'],
'features' => ['The cat cannot reach it', 'It hangs firmly in place', 'Shines brightly']
],
'5' => [
'title' => 'Breirbury organizer',
'img_url' => 'img/item-breirberi.jpg',
'price' => 5000,
'discount' => 3000,
'is_new' => true,
'is_last' => true,
'type' => 'other',
'colors' => ['yellow'],
'features' => ['So that your junk is always an arm’s reach away', 'Convenient', 'You can cook and watch a movie at the same time']
],
'6' => [
'title' => 'Mseyulida lamp',
'img_url' => 'img/item-mseyulida.jpg',
'price' => 4000,
'discount' => 500,
'is_new' => true,
'is_last' => false,
'type' => 'lighting',
'colors' => ['orange', 'green', 'yellow', 'blue', 'black'],
'features' => ['Suitable for any interior', 'Sturdy']
],
'7' => [
'title' => 'Rmaeribi sofa',
'img_url' => 'img/item-rmaeribi.jpg',
'price' => 15000,
'discount' => 4500,
'is_new' => true,
'is_last' => true,
'type' => 'furniture',
'colors' => ['green', 'black', 'red', 'blue'],
'features' => ['Soft', 'Cozy', 'Cats and children love it', 'Hides stains', 'Easy to clean']
],
'8' => [
'title' => 'Nnulm desk',
'img_url' => 'img/item-nnulm.jpg',
'price' => 5000,
'discount' => 0,
'is_new' => true,
'is_last' => false,
'type' => 'furniture',
'colors' => ['green'],
'features' => ['Eco-friendly', 'Lots of drawers', 'It has room for a mug and a pile of papers']
],
'9' => [
'title' => 'Tre furniture set',
'img_url' => 'img/item-tre.jpg',
'price' => 20000,
'discount' => 3000,
'is_new' => true,
'is_last' => true,
'type' => 'furniture',
'colors' => ['yellow', 'black'],
'features' => ['Relaxes', 'Doesn’t creak', 'Looks cool']
],
'10' => [
'title' => 'Granny style chandelier',
'img_url' => 'img/item-default-old-lamp.jpg',
'price' => 7000,
'discount' => 2000,
'is_new' => false,
'is_last' => true,
'type' => 'lighting',
'colors' => ['blue', 'black'],
'features' => ['Nostalgic', 'Fits into any interior', 'Your neighbors will envy it', 'Stylish']
],
'11' => [
'title' => 'Do lamp',
'img_url' => 'img/item-do.jpg',
'price' => 3500,
'discount' => 500,
'is_new' => true,
'is_last' => false,
'type' => 'lighting',
'colors' => ['black'],
'features' => ['Looks beautiful', 'Shines']
],
'12' => [
'title' => 'Tueta panel',
'img_url' => 'img/item-tueta.jpg',
'price' => 5000,
'discount' => 20,
'is_new' => true,
'is_last' => true,
'type' => 'textile',
'colors' => ['red'],
'features' => ['Will surprise your guests', 'It makes you want to touch it', 'Eye-catching']
],
'13' => [
'title' => 'Nmiao pillow',
'img_url' => 'img/item-nmyao.jpg',
'price' => 1500,
'discount' => 0,
'is_new' => false,
'is_last' => false,
'type' => 'textile',
'colors' => ['orange'],
'features' => ['Cozy for the cat', 'Comfortable for you', 'Fun for your kid']
],
'14' => [
'title' => 'Kel lamp',
'img_url' => 'img/item-kel.jpg',
'price' => 3000,
'discount' => 20,
'is_new' => true,
'is_last' => false,
'type' => 'lighting',
'colors' => ['orange', 'blue'],
'features' => ['Helps you read at night', 'Small', 'Exudes a cozy glow', 'Doesn’t bother others']
],
'15' => [
'title' => 'Omase pillow',
'img_url' => 'img/item-omase.jpg',
'price' => 2000,
'discount' => 100,
'is_new' => true,
'is_last' => true,
'type' => 'textile',
'colors' => ['grey', 'black'],
'features' => ['Brightly colored', 'Square', 'Soft']
],
'16' => [
'title' => 'Ormu basket',
'img_url' => 'img/item-ormu.jpg',
'price' => 2200,
'discount' => 20,
'is_new' => true,
'is_last' => false,
'type' => 'other',
'colors' => ['blue'],
'features' => ['Everything fits', 'You can plant a flower in it', 'Hides the cat']
],
'17' => [
'title' => 'Pinas paperclips',
'img_url' => 'img/item-pinas.jpg',
'price' => 100,
'discount' => 0,
'is_new' => true,
'is_last' => true,
'type' => 'other',
'colors' => ['blue', 'black'],
'features' => ['Do not rust', 'Strong', 'You get a bunch of them', 'There is enough to last a long time']
],
'18' => [
'title' => 'Preum compact cassette',
'img_url' => 'img/item-preum.jpg',
'price' => 200,
'discount' => 20,
'is_new' => true,
'is_last' => false,
'type' => 'other',
'colors' => ['blue', 'black'],
'features' => ['Soothing', 'Surprise your teen', 'You can rewind the tape with a pencil']
],
'19' => [
'title' => 'Rmob souvenir',
'img_url' => 'img/item-rmob.jpg',
'price' => 1500,
'discount' => 20,
'is_new' => false,
'is_last' => false,
'type' => 'other',
'colors' => ['green', 'orange', 'yellow'],
'features' => ['For the Marvel fan', 'You can plant a flower', 'Glorious', 'Makes you smile']
],
'20' => [
'title' => 'Tkuoko chandelier',
'img_url' => 'img/item-tkuoko.jpg',
'price' => 2100,
'discount' => 1000,
'is_new' => false,
'is_last' => false,
'type' => 'lighting',
'colors' => ['green', 'orange'],
'features' => ['Glitters', 'Shines', 'Looks expensive', 'Can be hung']
],
'21' => [
'title' => 'Briatuo armchairs',
'img_url' => 'img/item-briatuo.jpg',
'price' => 7000,
'discount' => 5500,
'is_new' => false,
'is_last' => true,
'type' => 'furniture',
'colors' => ['blue'],
'features' => ['Vivid', 'Deep', 'Beautiful', 'Relaxing', 'Comfortable for your back']
]
];
}
function get_filters() {
return [
0 => [
'url' => 'all',
'name' => 'All products',
],
1 => [
'url' => 'lighting',
'name' => 'Lighting',
],
2 => [
'url' => 'furniture',
'name' => 'Furniture',
],
3 => [
'url' => 'textile',
'name' => 'Textile',
],
4 => [
'url' => 'other',
'name' => 'Other',
]
];
}
function get_product_attribute($id, $attr) {
$products = get_products();
$result = $products[$id][$attr] ?? null;
return $result;
}
function get_product_price($id) {
return get_product_attribute($id, 'price');
}
function get_product_title($id) {
return get_product_attribute($id, 'title');
}
function get_img_url($id) {
return get_product_attribute($id, 'img_url');
}
function get_product_discount($id) {
return get_product_attribute($id, 'discount');
}
function get_product_is_new($id) {
return get_product_attribute($id, 'is_new');
}
function get_product_is_last($id) {
return get_product_attribute($id, 'is_last');
}
function get_product_features($id) {
return get_product_attribute($id, 'features');
}
</div><div
class="js--file"
data-visible="false"
data-active="false"
data-enabled="false"
data-title="style.css"
data-mode="css"
data-src="style.css"
data-selection=""
data-scroll-to=""
data-left-url-part=""
data-right-url-part=""
data-right-url-part-active="false"
data-browser-tab="false"
data-browser-tab-name=""
data-browser-tab-active="false"
data-browser-scroll="">.visually-hidden:not(:focus):not(:active),
input[type="checkbox"].visually-hidden,
input[type="radio"].visually-hidden {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
border: 0;
padding: 0;
white-space: nowrap;
clip-path: inset(100%);
clip: rect(0 0 0 0);
overflow: hidden;
}
body {
min-width: 550px;
padding: 0;
margin: 0;
font-family: "Arial", "Helvetica", sans-serif;
font-size: 13px;
line-height: 18px;
}
a {
text-decoration: none;
color: inherit;
}
.container {
width: 510px;
padding: 0 20px;
margin: 0 auto;
}
.site-navigation {
display: flex;
width: 510px;
padding: 0 20px;
margin: 0 auto;
justify-content: space-between;
}
.site-header {
position: relative;
z-index: 2;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.logo-link:hover,
.logo-link:focus {
opacity: 0.5;
}
.logo-link:active {
opacity: 0.3;
}
.logo-link img {
margin: 10px 0;
}
.navigation-list {
display: flex;
margin: 0 -15px 0 0;
padding: 0;
list-style: none;
flex-wrap: wrap;
justify-content: flex-end;
}
.navigation-list a:hover,
.navigation-list a:focus {
opacity: 0.5;
}
.navigation-list a:active {
color: #ff8a00;
}
.navigation-list a {
display: block;
padding: 12px 15px 11px;
color: #845927;
}
.intro .container {
z-index: -1;
min-height: 160px;
margin-bottom: 0;
padding: 20px 0 0;
box-sizing: border-box;
background-image: url("img/index-background.jpg");
background-repeat: no-repeat;
background-position: top right;
}
.intro-title {
width: 240px;
padding: 0;
margin: 0;
font-family: "Georgia", "Times", serif;
font-size: 28px;
line-height: 36px;
font-weight: 400;
}
.brands-title b,
.intro-title b,
.features-title b,
.delivery-text b {
font-weight: 400;
color: #ff8a00;
}
.intro p {
width: 210px;
margin: 8px 0 10px;
padding: 0;
line-height: 20px;
}
.quote {
display: block;
position: relative;
padding: 0 0 0 33px;
margin: 20px 0 20px;
font-family: "Georgia", "Times", serif;
font-style: italic;
}
.quote p {
padding: 0;
margin: 0;
font-size: 16px;
line-height: 24px;
quotes: none;
}
.quote::before {
position: absolute;
content: "«";
top: 0;
left: 0;
font-size: 36px;
color: #ff8a00;
}
.author {
display: block;
padding: 0;
margin: 4px 0;
}
.popular-products {
margin: 0;
background-color: #fff3e5;
}
.delivery,
.custom,
.contacts,
.catalog,
.item,
.order {
padding-top: 15px;
padding-bottom: 10px;
}
.delivery-title,
.custom-title,
.contacts-title,
.catalog-title,
.order-title {
padding: 0;
margin: 5px 0;
font-family: "Georgia", "Times", serif;
font-size: 28px;
line-height: 36px;
font-weight: 400;
}
.filters {
display: flex;
flex-wrap: wrap;
margin: 10px -10px -10px 0;
padding: 0;
list-style: none;
}
.filter {
display: flex;
padding: 8px 16px;
margin: 0 10px 10px 0;
color: #ff8a00;
border: 1px solid #ff8a00;
border-radius: 4px;
cursor: pointer;
}
.filter:focus,
.filter:hover {
color: #ffffff;
background-color: #ff8a00;
}
.filter:active {
box-shadow: inset 0 2px 10px #c86c00;
}
.filter.filter-current {
color: #ffffff;
background-color: #ff8a00;
box-shadow: inset 0 2px 10px #c86c00;
cursor: default;
}
.custom-columns {
display: flex;
flex-grow: 0;
}
.custom-columns img {
display: flex;
flex-shrink: 0;
align-items: center;
margin: 20px 20px 20px 0;
min-height: 200px;
}
.custom-columns div {
margin: 5px 0 20px;
}
.products-list {
display: flex;
padding: 20px 0 0;
margin: 0 0 0 -20px;
flex-wrap: wrap;
flex-shrink: 0;
list-style: none;
}
.products-list li {
display: flex;
}
.product-card {
position: relative;
display: flex;
width: 132px;
margin-bottom: 20px;
margin-left: 20px;
padding: 124px 12px 12px;
flex-direction: column;
background-color: #ffffff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.product-card-new {
position: relative;
}
.product-card-new::after {
position: absolute;
content: "new";
width: 34px;
height: 15px;
top: 8px;
right: -2px;
font-weight: 700;
line-height: 14px;
color: #ffffff;
text-align: center;
background-color: #ff8a00;
border-radius: 4px 0 0 4px;
}
.product-card:hover,
.product-card:focus {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.product-card:active {
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.product-card img {
position: absolute;
top: 0;
left: 0;
order: -1;
}
.product-card h3 {
margin: 0 0 2px 0;
padding: 0;
font-family: "Georgia", "Times", serif;
font-size: 15px;
line-height: 18px;
font-weight: 400;
}
.product-card p {
margin: 0 0 8px 0;
padding: 0;
font-family: "Georgia", "Times", serif;
font-style: italic;
font-size: 13px;
line-height: 16px;
}
.product-options {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: auto;
}
.price {
margin-right: 10px;
flex-shrink: 1;
font-weight: 700;
font-size: 15px;
color: #ff8a00;
}
.price::after {
content: "₽";
}
.colors-list {
display: flex;
margin: 4px 0 0 -4px;
padding: 0;
list-style: none;
}
.colors-list li {
box-sizing: border-box;
width: 10px;
height: 10px;
margin-left: 4px;
border-radius: 50%;
}
.color-orange {
background-color: orange;
}
.color-yellow {
background-color: yellow;
}
.color-green {
background-color: green;
}
.color-red {
background-color: red;
}
.color-blue {
background-color: blue;
}
.color-black {
background-color: black;
}
.color-white {
background-color: white;
border: 1px solid #c0c0c0;
}
.price del {
margin-right: 2px;
font-weight: 400;
font-size: 13px;
color: #000000;
text-decoration: line-through;
}
.map-link {
display: block;
margin-top: -20px;
margin-bottom: 30px;
color: #845927;
}
.map-link:hover,
.map-link:focus {
opacity: 0.5;
}
.map-link:active {
color: #ff8a00;
}
.contacts img {
display: flex;
flex-shrink: 0;
align-items: center;
margin: 20px 0 30px;
min-height: 200px;
}
.item-title {
display: inline-block;
vertical-align: baseline;
padding-right: 50px;
margin: 5px 0 0;
font-family: "Georgia", "Times", serif;
font-size: 28px;
line-height: 36px;
font-weight: 400;
}
.item-new {
position: relative;
}
.item-new::after {
position: absolute;
content: "new";
width: 38px;
height: 16px;
top: 13px;
right: 0;
font-family: "Arial", "Helvetica", sans-serif;
font-size: 15px;
font-weight: 700;
line-height: 14px;
color: #ffffff;
text-align: center;
background-color: #ff8a00;
border-radius: 4px;
}
.item-container {
display: flex;
}
.item-img {
display: flex;
flex-shrink: 0;
margin: 20px 0;
}
.item-hot .item-img {
position: relative;
padding-top: 36px;
}
.item-hot .item-img::before {
position: absolute;
content: "";
width: 290px;
height: 36px;
top: 0;
left: 0;
background-color: #fff3e5;
background-image: url("img/icon-hot.svg");
background-repeat: no-repeat;
background-size: 11px 14px;
background-position: 62px 10px;
}
.item-hot .item-img::after {
position: absolute;
content: "The product will soon sell out!";
top: 10px;
left: 80px;
}
.item-info {
margin: 8px 0 10px 20px;
flex-grow: 1;
}
.title-advantages {
margin: 10px 0 8px;
font-family: "Georgia", "Times", serif;
font-size: 15px;
line-height: 22px;
font-weight: 400;
}
.item-advantages {
margin: 0;
padding-left: 14px;
padding-bottom: 12px;
border-bottom: 1px solid #e2e2e2;
font-family: "Georgia", "Times", serif;
font-style: italic;
list-style: none;
}
.item-advantages li {
position: relative;
margin-bottom: 6px;
}
.item-advantages li::before {
position: absolute;
content: "";
width: 6px;
height: 6px;
top: 6px;
left: -14px;
background-color: #000000;
border-radius: 50%;
}
.item-buy {
display: flex;
flex-wrap: wrap;
margin: 16px 0 0;
}
.item-buy .price {
display: flex;
flex-wrap: wrap;
align-items: baseline;
position: relative;
max-width: 510px;
margin-top: -2px;
margin-bottom: 10px;
flex-shrink: 0;
}
.item-buy p {
margin: 0 30px 10px 0;
word-wrap: break-word;
}
.item-buy i {
display: block;
margin-bottom: 2px;
font-family: "Georgia", "Times", serif;
font-style: italic;
font-size: 13px;
font-weight: 400;
color: #000000;
}
.price-old i {
margin-bottom: 3px;
}
p.price-new {
margin-right: 0;
font-weight: 700;
font-size: 18px;
color: #ff8a00;
}
.button {
display: flex;
flex-shrink: 0;
max-width: 462px;
padding: 8px 24px 7px;
margin-bottom: 40px;
text-align: center;
color: #ffffff;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
background-color: #ff8a00;
border-radius: 4px;
box-shadow: 0 4px 4px rgba(255, 138, 0, 0.4);
}
.button:hover,
.button:focus {
background-color: #ff9900;
box-shadow: 0 6px 8px rgba(255, 138, 0, 0.4);
}
.button:active {
background-color: #ff8a00;
box-shadow: 0 2px 2px rgba(255, 138, 0, 0.6);
}
.order-list {
width: 100%;
margin: 10px 0 20px;
border-collapse: collapse;
text-align: left;
}
.order-list img {
width: 68px;
height: 52px;
margin-bottom: -5px;
}
.order-list tr {
border-bottom: 1px solid #e2e2e2;
}
.order-list td {
padding: 10px 20px 10px 0;
}
.order-list th:last-child {
width: 140px;
}
.order-list th {
padding: 10px 20px 10px 0;
font-family: "Georgia", "Times", serif;
font-style: italic;
font-weight: 400;
vertical-align: bottom;
}
.order-list td:last-child,
.order-list th:last-child {
padding-right: 0;
}
.contacts-info {
margin: -10px 0 20px;
}
.contacts-info p {
position: relative;
padding-left: 16px;
margin: 12px 0;
}
.contact-phone::before {
position: absolute;
content: "";
width: 10px;
height: 13px;
top: 2px;
left: 0;
background-image: url("img/icon-phone.svg");
}
.contact-address::before {
position: absolute;
content: "";
width: 9px;
height: 13px;
top: 2px;
left: 0;
background-image: url("img/icon-pin.svg");
}
.delivery-background {
display: flex;
flex-shrink: 0;
align-items: center;
margin: 20px 0 20px;
min-height: 200px;
background-image: url("img/delivery-background.jpg");
background-repeat: no-repeat;
background-position: center left;
}
.delivery-text {
width: 210px;
margin-left: auto;
padding: 16px 20px 20px;
background-color: #ffffff;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.delivery-text p {
margin: 8px;
padding: 0;
}
.brands {
padding-top: 20px;
padding-bottom: 4px;
background-color: #f8f8f8;
}
.brands-list {
display: flex;
padding: 0;
margin: 16px -20px 0 0;
flex-wrap: wrap;
list-style: none;
}
.brands-list li {
position: relative;
width: 112px;
margin: 0 20px 16px 0;
padding-top: 58px;
}
.brands-list li::before {
position: absolute;
content: "";
top: 0;
left: 0;
width: 112px;
height: 50px;
background-repeat: no-repeat;
}
.brands-ehm::before {
background-image: url("img/brands-ehm-grey.svg");
}
.brands-cubic::before {
background-image: url("img/brands-cubic-grey.svg");
}
.brands-tehnodom::before {
background-image: url("img/brands-tehnodom-grey.svg");
}
.brands-dg::before {
background-image: url("img/brands-dg-grey.svg");
}
.brands-ehm:hover::before {
background-image: url("img/brands-ehm.svg");
}
.brands-cubic:hover::before {
background-image: url("img/brands-cubic.svg");
}
.brands-tehnodom:hover::before {
background-image: url("img/brands-tehnodom.svg");
}
.brands-dg:hover::before {
background-image: url("img/brands-dg.svg");
}
.features {
padding-top: 20px;
padding-bottom: 10px;
}
.brands-title,
.features-title,
.services-title,
.products-title {
margin: 0;
padding: 0;
font-family: "Georgia", "Times", serif;
font-size: 20px;
line-height: 24px;
font-weight: 400;
}
.features-list {
display: flex;
padding: 0;
margin: 14px 0 0;
justify-content: space-between;
flex-wrap: wrap;
list-style: none;
}
.features-list li {
position: relative;
width: 142px;
margin-bottom: 10px;
}
.features-list li::before {
position: absolute;
content: "";
top: 2px;
left: 0;
}
.feature-unique {
padding-left: 22px;
}
.feature-unique::before {
width: 16px;
height: 12px;
background-image: url("img/feature-unique.svg");
}
.feature-organic {
padding-left: 25px;
}
.feature-organic::before {
width: 19px;
height: 12px;
background-image: url("img/feature-organic.svg");
}
.feature-protected {
padding-left: 16px;
}
.feature-protected::before {
width: 10px;
height: 12px;
background-image: url("img/feature-protected.svg");
}
.site-footer {
background-color: #847462;
}
.site-footer .container {
display: flex;
flex-grow: 1;
justify-content: space-between;
}
.copyright {
margin: auto 0;
flex-shrink: 0;
color: #ffffff;
}
.site-footer .navigation-list {
margin-right: 15px;
margin-left: -15px;
justify-content: left;
}
.copyright + .navigation-list {
justify-content: center;
margin-left: 15px;
}
.site-footer a {
display: block;
margin: 0;
padding: 14px 15px;
color: #ffffff;
}
.social-list {
display: flex;
width: 110px;
padding: 0;
margin: 0 -10px 2px;
justify-content: end;
flex-shrink: 0;
flex-wrap: wrap;
align-items: center;
list-style: none;
}
.social-list a {
display: block;
width: 14px;
height: 14px;
padding: 10px;
background-repeat: no-repeat;
background-position: center;
}
.social-link-twitter {
background-image: url("img/icon-twitter.svg");
}
.social-link-instagram {
background-image: url("img/icon-instagram.svg");
}
.social-link-facebook {
background-image: url("img/icon-facebook.svg");
}
.social-list a:hover,
.social-list a:focus {
opacity: 0.5;
}
.social-list a:active {
opacity: 0.3;
}
.pagination {
display: flex;
flex-wrap: wrap;
margin: 10px -10px -10px 0;
padding: 0;
list-style: none;
}
.pagination a {
display: flex;
padding: 8px 16px;
margin: 0 10px 10px 0;
color: #ff8a00;
border: 1px solid #ff8a00;
border-radius: 4px;
cursor: pointer;
}
.pagination a:focus,
.pagination a:hover {
color: #ffffff;
background-color: #ff8a00;
}
.pagination a:active {
box-shadow: inset 0 2px 10px #c86c00;
}
.pagination a.current {
color: #ffffff;
background-color: #ff8a00;
box-shadow: inset 0 2px 10px #c86c00;
cursor: default;
}
.banner {
display: flex;
justify-content: center;
align-items: center;
height: 96px;
max-width: 100%;
background-color: #FF8A00;
background-image: url("img/bg_img.svg");
background-repeat: no-repeat;
background-size: contain;
background-position: center;
}
.banner p {
width: 380px;
color: #333333;
font-family: "Georgia", "Times", serif;
font-size: 16px;
line-height: 22px;
text-align: center;
}
</div></div><div class="course-layout__files hidden"></div><div class="course-layout__editors"></div><div class="course-editor-controls"><button class="course-editor-controls__item course-editor-controls__item--answer" type="button">Show the answer</button></div><div class="js--feedback course-unhappy"><button class="js--feedback-btn course-unhappy__button" type="button"><span class="sr-only">Complain</span><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#unhappy"></use></svg></button><div class="js--feedback-modal course-unhappy__modal course-unhappy__modal--step-one"><form method="POST" action="/courses/php-basics/php-numbers-strings/date-function/signal" class="course-unhappy__form form"><input type="hidden" name="csrf_name" value="csrf69aebbb879809"><input type="hidden" name="csrf_value" value="7dce0e623f9df2c74765cf888c0b0673"><p class="course-unhappy__text">What didn’t you like in this task?</p><div class="course-unhappy__slide"><div class="course-unhappy__wrap"><div class="course-unhappy__list"><label class="checkbox checkbox--small"><input class="checkbox__input" name="problems" value="1" type="checkbox"><span class="checkbox__text">The code check doesn’t work</span></label><label class="checkbox checkbox--small"><input class="checkbox__input" name="problems" value="2" type="checkbox"><span class="checkbox__text">The task is too difficult</span></label><label class="checkbox checkbox--small"><input class="checkbox__input" name="problems" value="3" type="checkbox"><span class="checkbox__text">The theory is hard to understand</span></label><label class="checkbox checkbox--small"><input class="js--feedback-other-checkbox checkbox__input" name="problems" value="0" type="checkbox"><span class="checkbox__text">Other (will write below)</span></label></div><div class="course-unhappy__message"><label class="sr-only" for="id-message">Другое (сейчас напишу)</label><textarea class="field field--area" id="id-message" name="message" placeholder="For example, a typo in the word «heading»"></textarea></div></div></div><button class="course-unhappy__control course-unhappy__control--prev" type="button"><span class="sr-only">Prev</span><svg aria-hidden="true"><use xlink:href="/img/sprites/landings.svg#arrow"></use></svg></button><button class="course-unhappy__control course-unhappy__control--next" type="button" disabled><span class="sr-only">Next</span><svg aria-hidden="true"><use xlink:href="/img/sprites/landings.svg#arrow"></use></svg></button><button class="js--submit-btn button" disabled>Submit</button></form><p class="course-unhappy__result hidden">Thanks! We’ll fix everything at once!</p></div></div></div><div class="course-layout__column course-layout__column--right"><span class="course-separator-control"><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#icon-arrows-separator"></use></svg></span><div class="course-browser"><div class="course-browser__menu"><div class="course-browser__address course-browser__address--without-fade course-browser__menu-item"><ul class="js--course-browser-tabs course-browser__menu-item__inner course-tabs course-tabs--left"></ul></div><button class="js--autorun course-browser__menu-item course-browser__menu-button course-browser__menu-button--text-with-icon course-browser__menu-button--autorun course-browser__menu-button--autorun-on" title="Autorun" type="button"><span class="course-browser__menu-item-inner"><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#icon-autorun"></use></svg>
Autorun
</span></button><button class="course-browser__menu-item course-browser__menu-button course-browser__menu-button--expand" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewBox="0 0 11 11"><path d="M1.375 5.125v4.5h4.5m3.75-3.75v-4.5h-4.5" fill="none" fill-rule="evenodd" stroke="currentColor"></path></svg></button></div><div class="course-browser__controls"><div class="course-browser__address-bar js--address-bar course-browser__address-bar--active"><form class="course-browser__address-bar-form js--address-bar-form"><button class="course-browser__address-bar-refresh-button js--address-bar-refresh-btn"><span class="sr-only">Refresh page</span><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#refresh"></use></svg></button><span class="course-browser__address-bar-path js--address-bar-path"></span><input class="course-browser__address-bar-input js--address-bar-input hidden" type="text" spellcheck="false" autocorrect="off" autocapitalize="none"/></form></div><div class="course-browser__menu course-browser__menu--no-indent"><button class="course-browser__menu-item course-browser__menu-button course-browser__menu-button--increase" type="button" disabled title="Larger"><span class="course-browser__menu-item-inner">Larger</span></button></div></div><div class="course-browser__notification js--browser-change-heading hidden"><p class="course-browser__notification-text">The code has changed, click “Refresh” or turn autorun on.</p><button class="course-browser__notification-button course-browser__notification-button--refresh js--close" type="button"><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#icon-refresh"></use></svg>
Refresh</button></div><div class="course-browser__content"><div class="course-browser__modal js--browser-modal"><div class="course-browser__notification course-browser__modal-heading js--browser-modal-heading"><p class="course-browser__notification-text">You’ve gone to a different page</p><button class="course-browser__notification-button js--close" type="button">← Go back</button></div><div class="course-browser__zoomer"><iframe class="js--preview-document course-browser__zoomer-element"></iframe><span class="course-browser__modal-address hidden js--browser-modal-address"></span><div class="course-browser__zoomer-info hidden"><div class="course-browser__zoomer-info-inner"><span class="course-browser__zoomer-info-icon course-browser__zoomer-info-icon--spinner"><svg aria-hidden="true" width="60" height="60"><use xlink:href="/img/sprites/courses.svg#mini-browser_spinner"></use></svg></span><span class="course-browser__zoomer-info-icon course-browser__zoomer-info-icon--error"><svg aria-hidden="true" width="60" height="60"><use xlink:href="/img/sprites/courses.svg#mini-browser_error-icon"></use></svg></span><p class="course-browser__zoomer-info-text"><b>An error has occurred</b></p><p class="course-browser__zoomer-info-text">due to a lack of resources or an error in the program, try to fix the code to restart it</p></div></div></div></div><div class="course-browser__menu course-browser__menu--vertical course-browser__menu--without-top-border"><span class="course-browser__menu-item course-browser__zoom"><span class="course-browser__menu-item-inner">100%</span></span><button class="course-browser__menu-item course-browser__menu-button course-browser__menu-button--decrease" type="button" title="Smaller"><span class="course-browser__menu-item-inner">Smaller</span></button></div><div class="js--validation-view course-browser__results-restriction course-browser__results-restriction--dumpo course-browser__results-restriction--mini"><span class="tooltip tooltip--light tooltip--short course-browser__results-restriction-tooltip"><span class="js--tooltip-text"></span><button class="js--validation-view-close course-browser__results-restriction-tooltip-close icon-close" type="button">Закрыть</button></span></div></div><div class="console console--modal js--console"><h2 class="sr-only">Console</h2><div class="console__heading"><span class="console__heading-title">Console<span class="console__counter hidden js--console__counter"></span></span><button title="Toggle console" class="console__heading-button js--console__toggle" type="button"><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#icon-collapse"></use></svg></button></div><div class="console__content js--console__content"></div></div><div class="course-goals js--goals"><div class="course-goals__heading"><span class="course-goals__heading-title"><span class="course-goals__count-label">Goals</span><span class="course-goals__count">completed</span></span><button class="course-goals__button course-goals__button--expand js--goals__expand" type="button"><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#icon-collapse"></use></svg></button><a class="course-goals__button course-goals__button--next button button--green button--without-border hidden" href="/courses/php-basics/php-numbers-strings/change-date-format" title="Changing the date format"><svg aria-hidden="true"><use xlink:href="/img/sprites/courses.svg#arrow-white--mini"></use></svg></a></div><div class="course-goals__content"><ol class="course-goals__list"><li class="course-goals__list-item">On line 2, change <code class="nowrap">01/01/1970</code> to the variable <code>$today</code><span class="mark">.</span> Use shorthand notation to insert the PHP code.<br>Please note how today’s date is displayed in the mini-browser.</li><li class="course-goals__list-item">One line 13 of the <code class="nowrap">catalog.php</code> file, change <code class="nowrap">'j F y'</code> to <code class="nowrap">'d.m.Y'</code><span class="mark">.</span><br> Please note how the date on the page is now displayed in a different format.</li></ol></div></div></div></div></article></div><div class="course-interface__overlay course-interface__overlay--active"></div></main><script
src="https://assets.htmlacademy.org/scripts/courses-spa/htmlacademy-task.v43.js"
data-task-type="php"
data-assets-path="https://assets.htmlacademy.org/scripts/courses-spa/"
data-lang="en"
></script><script>HtmlacademyTask.setRoutes({task:'/courses/php-basics/php-numbers-strings/date-function',check:'/courses/php-basics/php-numbers-strings/date-function/check'});</script><script>HtmlacademyTask.setup(function(){this.setView(PhpView),this.setRunner(PhpRunner),this.setChecker(PhpChecker,function(){this.setMatcher(function(t){t.goal("change.symbols").code('"#builtin.anything"; $today = date(\'d.m.Y\'); "#builtin.anything";')}),this.addGoal("php.products.today",function(t){return t.file("components/products_list.php").equals(/<section class="banner">[ *\n* *]*<p>.*declared.*[ *\n* *]*<\?= *[$]today *\?>[ *\n* *]*.*is.*<\/p>/)}),this.addGoal("change.symbols",function(t){return!!this.isSolved("php.products.today")&&t.file("catalog.php").matches("change.symbols")})}),this.setAnswers([{goal:1,editor:"components/products_list.php",data:function(){this.tooltip("Change the date to the variable <code>$today</code>").at(0).find("01/01/1970").replace("<?= $today ?>")}},{goal:2,editor:"catalog.php",data:function(){this.tooltip("Change <code>'j F y'<code> to <code>'d.m.Y'</code>").at(12).find("j F y").replace("d.m.Y")}}])});</script><footer class="page-footer page-footer--tiny"><div class="page-footer__inner"><p><a href="/docs/cookies">Cookies</a> ∙
<a href="/docs/privacy">Privacy</a> ∙
<a href="/docs/agreement">License Agreement</a> ∙
<a href="/docs/about">About</a> ∙
<a href="/contacts">Contacts</a> ∙
© HTML Academy OÜ, 2019−2026
</p><div class="page-footer__financial"><img src="https://assets.htmlacademy.org/img/visa-white.svg?cs=96e54ec8c587db9d4b1d8d328ffd87c2ebfd9555" alt="VISA" title="VISA" width="35" height="35"><img src="https://assets.htmlacademy.org/img/mastercard-horizontal.v2.svg" alt="Mastercard" title="Mastercard" width="35" height="35"></div></div></footer><div class="modal"><div class="modal__inner"><div class="modal__wrapper js-login hidden"><button class="modal__close icon-close" type="button" title="Close" data-modal="close"></button><h4 class="modal__header">Log in</h4><ul class="modal__social"><li class="modal__social-link modal__social-link--fb"><a href="/login/fb?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-numbers-strings%2Fdate-function" rel="nofollow" title="Log in via Facebook"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#facebook"></use></svg></a></li><li class="modal__social-link modal__social-link--google"><a href="/login/google?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-numbers-strings%2Fdate-function" rel="nofollow" title="Log in via Google"><svg height="30" width="30" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="#ffffff" d="M457.732 216.625c2.628 14.041 4.063 28.743 4.063 44.098C461.796 380.688 381.481 466 260.204 466c-116.023 0-210-93.977-210-210s93.977-210 210-210c56.704 0 104.077 20.867 140.44 54.73l-59.204 59.197v-.135c-22.046-21.002-50-31.762-81.236-31.762-69.297 0-125.604 58.537-125.604 127.841 0 69.29 56.306 127.968 125.604 127.968 62.87 0 105.653-35.965 114.46-85.312h-114.46v-81.902h197.528z"/></svg></a></li></ul><div class="modal__or"><span>or</span></div><form class="modal__form form" action="/login?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-numbers-strings%2Fdate-function" autocomplete="off" method="post" data-submit="o"><input type="hidden" name="csrf_name" value="csrf69aebbb879809"><input type="hidden" name="csrf_value" value="7dce0e623f9df2c74765cf888c0b0673"><div class="form__group"><label class="sr-only" for="login-email">Email</label><input class="field field--text field--full-width" type="email" name="email" placeholder="Email" value="" id="login-email"></div><div class="form__group"><label class="sr-only" for="login-password">Password</label><input class="field field--text field--full-width ym-disable-keys" type="password" name="password" placeholder="Password" id="login-password"></div><input class="button button--full-width" type="submit" data-submit-text="Logging in…" value="Log in"></form><p class="modal__forgot-password"><a href="/recover" data-modal="open" data-value="recover">Forgot your password?</a></p><a class="modal__bottom-link" href="/signup" data-modal="open" data-value="register">Sign up</a></div><div class="modal__wrapper js-register hidden"><button class="modal__close icon-close" type="button" title="Close" data-modal="close"></button><h4 class="modal__header">Sign up</h4><ul class="modal__social"><li class="modal__social-link modal__social-link--fb"><a href="/login/fb?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-numbers-strings%2Fdate-function" rel="nofollow" title="Log in via Facebook"><svg aria-hidden="true"><use xlink:href="/img/sprites/general.svg#facebook"></use></svg></a></li><li class="modal__social-link modal__social-link--google"><a href="/login/google?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-numbers-strings%2Fdate-function" rel="nofollow" title="Log in via Google"><svg height="30" width="30" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="#ffffff" d="M457.732 216.625c2.628 14.041 4.063 28.743 4.063 44.098C461.796 380.688 381.481 466 260.204 466c-116.023 0-210-93.977-210-210s93.977-210 210-210c56.704 0 104.077 20.867 140.44 54.73l-59.204 59.197v-.135c-22.046-21.002-50-31.762-81.236-31.762-69.297 0-125.604 58.537-125.604 127.841 0 69.29 56.306 127.968 125.604 127.968 62.87 0 105.653-35.965 114.46-85.312h-114.46v-81.902h197.528z"/></svg></a></li></ul><div class="modal__or"><span>or</span></div><form class="modal__form form" action="/signup?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-numbers-strings%2Fdate-function" autocomplete="off" method="post"><input type="hidden" name="csrf_name" value="csrf69aebbb879809"><input type="hidden" name="csrf_value" value="7dce0e623f9df2c74765cf888c0b0673"><div class="form__group"><label class="sr-only" for="email">
Email
<span class="required"><span class="sr-only">Required field</span><span class="required__star">*</span></span></label><div class="form__group-fields"><input class="field field--text field--full-width" type="email" name="email" value="" id="email" required placeholder="Email"></div></div><div class="form__group"><label class="sr-only" for="password">
Password
<span class="required"><span class="sr-only">Required field</span><span class="required__star">*</span></span></label><div class="form__group-fields"><input class="field field--text field--full-width" type="password" name="password" value="" id="password" required placeholder="Password"></div></div><div class="form__group"><label class="checkbox"><input class="checkbox__input" type="checkbox" name="agreement" value="1" required><span class="checkbox__text"><span>By signing up, you agree to our <a href="/docs/agreement" target="_blank">License Agreement</a> and <a href="/docs/privacy" target="_blank">Privacy Policy</a>.</span></span></label></div><input class="button button--full-width" type="submit" data-submit-text="Signing up…" value="Sign up"></form><a class="modal__bottom-link" href="/login?redirect_url=%2Fcourses%2Fphp-basics%2Fphp-numbers-strings%2Fdate-function" data-modal="open" data-value="login">Log in</a></div><div class="modal__wrapper modal__wrapper--no-btn-bottom js-recover hidden"><button class="modal__close icon-close" type="button" title="Close" data-modal="close"></button><h4 class="modal__header">Restore access</h4><p class="modal__text-accent">Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.</p><form class="modal__form form" action="/recover" autocomplete="off" method="post" data-submit="o"><input type="hidden" name="csrf_name" value="csrf69aebbb879809"><input type="hidden" name="csrf_value" value="7dce0e623f9df2c74765cf888c0b0673"><div class="form__group"><label class="sr-only" for="recovery-email">Email</label><input class="field field--text field--full-width" type="email" name="email" placeholder="Email" value="" id="recovery-email"></div><script src='https://www.google.com/recaptcha/api.js'></script><div class="form__group"><div class="g-recaptcha" data-sitekey="6LetCTEqAAAAANROWtPzfC7Rfg9iIRiRt2k2FPn7"></div></div><input class="button button--full-width" type="submit" data-submit-text="Sending…" value="Send"></form><p class="modal__text">Forgot to connect your email to the profile? Email us and we’ll help.</p></div></div></div><script async src="https://assets.htmlacademy.org/js/general.v274.js" data-assets="https://assets.htmlacademy.org" data-require="toggle,navigation-courses,modal,form,nav"></script></body></html>