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.
passthru('ffmpeg -i /home/dokuro/vedeos/60fps_FREELY_TOMORROW_-_Hatsune_Miku.mp4', $response);
function foo($bar, $baz)
{
$argsCount = func_num_args();
if ($argsCount === 2) {
echo "correct \n";
} else {
echo "error: expected 2 arguments, got $argsCount\n";
}
}
App.lang = 'ru'; // app = вымышленный объект
<span class="client__title" data-translate="client_title"></span>
$(function() {
var file = '/locale/' + App.lang + '.json';
// Тут предположим, что response = есть содержимое файла
$.get(file).then(function (response) {
// Идем по всем файлам и заменяем контент
$('[data-translate]').each(function () {
var $elem = $(this),
locKey = $elem.data('translate');
// Если ключ найден
if (response[locKey]) {
$elem.html(response[locKey]);
}
});
});
});
$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"