public function getDate(): ?string
{
return $this->date;
}
// Здесь убрать инициализацию, потому что в конструкторе всё равно заполнится
public ?string $date;
// А здесь, наоборот, указать дефолтное значение
public function __construct(int $id, ?string $name = null)
{
$this->id = $id;
$this->name = $name;
}
To enable extensions, verify that they are enabled in your .ini files:
Alternatively, you can run Composer with `--ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions.
<div class="block">
<img src="..." onload="this.classList.add('loaded')">
<span>Текст поверх картинки</span>
</div>
.block {
position: relative;
}
.block span {
position: absolute;
display: none;
}
.block img.loaded + span {
display: block;
}
$array = ['первый', 'второй'];
[$var1, $var2] = $array;
echo $var1; // 'первый'
echo $var2; // 'второй'
$array = ['first' => 'первый', 'second' => 'второй'];
['first' => $var1, 'second' => $var2] = $array;
echo $var1; // 'первый'
echo $var2; // 'второй'
$com_offer['offer_count'] += ( $_item['quantity'] ?? 1 );
$com_offer['offer_total'] += $_item['sale'] * ( $_item['quantity'] ?? 1 );
$quantity = $_item['quantity'] ?? 1;
$com_offer['offer_count'] += $quantity;
$com_offer['offer_total'] += $_item['sale'] * $quantity;