var
path = 'aaa.bbb.ccc.ddd',
data = {
aaa: {
bbb: {
ccc: {
ddd: 'Hello!!'
}
}
}
};
console.log(path.split('.').reduce((p, c) => p[c], data)); // Hello!!
return '<div class="review__content">
<p>' . get_post_meta(get_the_ID(), "reviews", true) . '</p>
</div>';
$str = "/hello/{:num}/{:str}/";
$replace = [
"num" => "[0-9]",
"str" => "[a-zA-Z]"
];
$str = preg_replace_callback(
'/{:(.*)}/U',
function ($matches) use ($replace) {
if(isset($replace[$matches[1]])) {
return $replace[$matches[1]];
}
else {
return $matches[0];
}
},
$str
);
echo $str;
ideone.com/6OT3Wl function init() {
gapi.client.init({
'apiKey': '...',
'discoveryDocs': [...],
...
}).then(...)
};
function loadClient() {
gapi.load('auth2', init);
}
map instanceof map.constructor; // true!
map.constructor.name === 'n';
. Следовательно Microsoft.Maps.Map - фабрика, а этот конструктор был сжат минификатором и не предусматривает доступа извне.