function getUrlLanguage($defaultLanguage = 'ru', $allowedLanguages = ['ru', 'en']) {
$urlLanguage = $defaultLanguage;
$urlPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if ($urlPath) {
$urlPathExploded = explode('/', $urlPath);
if (in_array($urlPathExploded['1'], $allowedLanguages)) {
$urlLanguage = $urlPathExploded['1'];
}
}
return $urlLanguage;
}
$currentLocalizeUrl = sprintf(
"%s://%s%s%s",
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
$_SERVER['SERVER_NAME'],
"en",
$_SERVER['REQUEST_URI']
);
// Массив данных
$arr = [];
// Текущее время
$currentTime = date("H:i");
// Проверка на наличие данных для текущего времени
if (array_key_exists($currentTime, $arr)) {
// Отображаем данные
print_r($arr[$currentTime]));
}
$attribute_name = 'body_'.$lang;
$model->$attribute_name = implode($body);
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$email_md5 = basename($url); // C93D3BF7A7C4AFE94B64E30C2CE39F4F
function persistence(num) {
function multiply(n) {
return n.reduce(function(a, b) {
return a * b;
});
}
var count = 0;
while (num.toString().length > 1) {
num = num.toString().split("");
num = multiply(num);
count++;
}
return count;
}
console.log(persistence(999));
$(document).ready(function() {
var params = window.location.search.replace(/\+/g, '%20');
$('a').each( function(i) {
if (this.href.indexOf('?') == -1) {
this.href = this.href + params;
} else if (params.length) {
this.href = this.href + '&' + params.substr(1);
}
});
});
$arr = [['name' => 412], ['name' => 3144], ['name' => 632]];
$new_arr = array_combine(range(1, count($arr)), array_values($arr));
var_dump($new_arr);
/*
array(3) {
[1]=>
array(1) {
["name"]=>
int(412)
}
[2]=>
array(1) {
["name"]=>
int(3144)
}
[3]=>
array(1) {
["name"]=>
int(632)
}
}
*/
<div id="{{ $modal_id }}" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog {{ $modal_dialog_styles}} modal-dialog-centered" role="document">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-label="Закрыть"></button>
<div class="modal-header">
<h3 class="modal-title text-center">{{ $modal_title }}</h3>
</div>
<div class="modal-body">
<div class="row justify-content-center">
<div class="col-12 col-lg-10">
{{ $slot }}
</div>
</div>
</div>
<div class="modal-footer row justify-content-center">
{{ $modal_footer }}
</div>
</div>
</div>
</div>
@component('modal', ['modal_id' => '1', 'modal_title' => 'Модальное окно'])
Содержание окна
@endcomponent