containerWrap = document.getElementById("container");
var jQueryMinJs = document.createElement("script");
jQueryMinJs.onload = loadOtherScripts;
jQueryMinJs.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js";
containerWrap.appendChild(jQueryMinJs);
function loadOtherScripts() {
$.getScript('js/script__.js', function () {
console.log('script__.js loaded');
});
}
php > echo "is_auth = " . false . ";\r\n";
is_auth = ;
php > echo "is_auth = " . json_encode(false) . ";\r\n";
is_auth = false;
A boolean TRUE value is converted to the string "1". Boolean FALSE is converted to "" (the empty string). This allows conversion back and forth between boolean and string values.
$search_string = preg_replace("/[^A-Za-z0-9А-Яа-я]+$/u", "", $_POST['query']);
$strings = [
'foo',
'фУbar',
'бар',
'53252',
'-x-x-x-x-'
];
foreach ($strings as $string) {
var_dump(preg_replace('/[^A-Za-z0-9А-Яа-я]+/u', '', $string));
}
string(3) "foo"
string(7) "фУbar"
string(6) "бар"
string(5) "53252"
string(4) "xxxx"
$('a').on('click', function(event) {
event.preventDefault();
var url = $(this).attr('href');
Router.change(url);
});
// Router.change
function change(url) {
history.pushState(url);
var view = this.getView(url);
ViewManager.setView(view);
var controller = this.getController(url);
controller.dispatch();
}