function replace_unicode_escape_sequence($match) {
return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
}
function unicode_decode($str) {
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $str);
}
echo unicode_decode("\u041f\u0435\u0440\u0432\u044b\u0439 \u043e\u0442\u0447\u0435\u0442");
hasOwnProperty
.const items = {
a: 1,
b: 2,
c: 3,
d: 4,
e: 5,
};
Object.keys(items).forEach(key => {
if (items[key] % 2 === 0) delete items[key];
});
class Finder {
public static function find($func) {
return file_get_contents("https://www.php.net/manual/ru/function.{$func}.php");
}
}
file_get_contents("https://www.php.net/search.php?show=quickref&pattern={$func}");
class Finder {
public static function find($func) {
$url = "https://www.php.net/search.php";
return file_get_contents($url . http_build_query([
"show" => "quickref",
"pattern" => $func
]));
}
}
build: function () {
this.constructor.superclass.build.call(this);
this._$element = $('.popover', this.getParentElement());
this.applyElementOffset();
this._$element.find('.close')
.on('click', $.proxy(this.onCloseClick, this));
},
const mapStateToProps = store => {
return {
user: store.user.user
};
};
const initialStateUser = {
name: "Вася"
};
balance, amount
в функции это локальные переменные, они не имею отношения к глобальным, имя не имеет значение, и то что оно одинаковое путает тебя. function replaceText(text, textToReplace) {
function replace(nodes) {
nodes.forEach(node => {
if (node instanceof HTMLScriptElement) {
return;
}
if (node instanceof HTMLStyleElement) {
return;
}
if (node instanceof Text) {
if (node.nodeValue.match(text)) {
node.nodeValue = node.nodeValue.replace(text, textToReplace)
}
}
else {
replace(Array.from(node.childNodes));
}
});
}
replace(Array.from(document.body.childNodes));
}
replaceText("{DATETIME}", "___WwW___");
const button = document.querySelector(".modal-button");
...
const modal = document.querySelector(".modal");
...
button.addEventListener("click", () => {
if (modal.classList.contains("is-active")) {
modal.classList.remove("is-active");
}
else {
modal.classList.add("is-active");
}
});