document.addEventListener('DOMContentLoaded', function () {
var _searchInput = document.querySelector('[name="search-query"]');
_searchInput.xhr = function () {
fetch('/url?q=' + encodeURIComponent(this.value))
.then(function (res) {
/* … */
})
.catch(function (rej) {
/* … */
});
};
document.querySelector('div.search-btn').addEventListener('click', function () {
_searchInput.xhr();
});
});
interface MyInterface {
name: string
}
enum ANY_NAMES {
VAL_1 = "Значение 1",
VAL_2 = "Значение 2",
VAL_3 = "Значение 3",
}
interface MyInterface {
name: ANY_NAMES;
}
$res = [];
foreach($object as $prop => $value) {
$res[] = "{$prop}={$value}";
}
$res = implode(",", $res);
<p>Element.prototype['offsetFrom'] = function (element) {
var ret = {};
var currentBounds = this.getBoundingClientRect();
var elementBounds = element.getBoundingClientRect();
ret.top = currentBounds.top - elementBounds.top;
ret.left = currentBounds.left - elementBounds.left;
ret.bottom = currentBounds.bottom - elementBounds.bottom;
ret.right = currentBounds.right - elementBounds.right;
ret.topHeight = ret.top + currentBounds.height;
ret.leftWidth = ret.left + currentBounds.width;
return ret;
};</p>
<p>if (!Element['scrollMe']) {
Element.prototype['scrollMe'] = function () {
window.scrollTo({
top: this.offsetFrom(document.body).top,
left: this.offsetFrom(document.body).left,
behavior: 'smooth'
});
};
}</p>
<p></script></p>
/* Вот ты получил уже Timestamp */
$dates = DateTime::createFromFormat ('j-M-Y',$userSettings->date_subscription);
/* Теперь тебе не надо уже преобразовывать из строки время, так как оно уже есть в $dates. Теперь просто прибавляй месяц. */
$dates->modify('+1 month');
echo $dates->format('j-M-Y'); //Получаешь обратно свою строку +1 месяц