<div id="rpl">
Иди в лес
</div>
<script>
"use strict";
(function(node) {
var rpl= {
'привет':'hello', 'пошел|иди|ступай':'go', 'на|в':'to', 'лес':'forest'
};
Object.keys(rpl).forEach(function(i) {
node.innerHTML = node.innerHTML.replace(new RegExp(i,'ig'),rpl[i]);
})
})(document.querySelector('#rpl'));
</script>
var a = [
{val1: 1, val2: 1},
{val1: 2, val2: 2},
{val1: 3, val2: 3}
];
function sumProps (arr) {
var out = {};
arr.forEach(function(i) {
for (var p in i) {
if (i.hasOwnProperty(p)) {
out[p] = out[p] || 0;
out[p] += i[p];
}
}
});
return out;
}
console.log(sumProps (a));
print_r($GLOBALS);
$classes = get_declared_classes();
$arr = [];
foreach($classes as $class)
{
if(count(get_class_methods($class)) != 0) $arr[$class]['methods'] = get_class_methods($class);
if(count(get_class_vars($class)) != 0) $arr[$class]['vars'] = get_class_vars($class);
}
print_r($arr);
cookies({ cookieKey: 'value' }, { domain: 'sub.example.com' });