input = $('input:last')
del.click(function(){
let input = $('input:last');
input.remove();
});
function createArrays($count = 3)
{
$result = [];
for ($i = 1; $i <= 3; $i++) {
${'arr_' . $i} = [rand(10, 20)];
$result[] = ${'arr_' . $i};
}
return $result;
}
$result = [];
foreach (createArrays() as $arr) {
$result = array_merge($result, $arr);
}
echo '<pre>';
var_dump($result);
echo '</pre>';
function handler(array $input): array
{
$output = $input;
$idsForDelete = [];
foreach ($input as $i => $item) {
$code = $item['CODE'];
$number = $item['NUMBER'];
if ($code !== 300) {
continue;
}
$key = $number . '-' . $code;
if (isset($idsForDelete[$key])) {
$idsForDelete[$key][] = $i;
} else {
$idsForDelete[$key] = [];
}
}
foreach ($idsForDelete as $ids) {
foreach ($ids as $i => $id) {
unset($output[$id]);
}
}
$arrayWith200 = [];
$arrayWith300 = [];
foreach ($output as $i => $item) {
$code = $item['CODE'];
$number = $item['NUMBER'];
if ($code === 200) {
$arrayWith200[$i] = $number;
}
if ($code === 300) {
$arrayWith300[$i] = $number;
}
}
foreach ($arrayWith300 as $i => $number) {
$key = array_search($number, $arrayWith200);
if ($key === false) {
continue;
}
unset($output[$i]);
unset($output[$key]);
}
return $output;
}
print_r(handler($arr));
Array
(
[6] => Array
(
[ID] => 7
[CODE] => 300
[NUMBER] => 10003
[DATE] => 2020-03-01T10:00:00
)
)
$('#file').on('change', ({ target: { files: [ file ] } }) => {
$('#info-file').html([ 'name', 'size', 'type' ]
.map(n => `<div>${n}: ${file[n]}</div>`)
.join('')
);
});
$("document").ready(function(){
$("#send").click(function(e){ // ← тут правим
var send = $("form").serialize();
$.ajax({
url: "test.php",
type: "POST",
data: send,
success: function(data){
console.log(data); // ?????
}
});
e.preventDefault(); // ← и тут добавляем
});
});
<ifModule mod_expires.c>
ExpiresActive On
#по умолчанию кеш в 5 секунд
ExpiresDefault "access plus 1 days"
# Включаем кэширование изображений и флэш на месяц
ExpiresByType image/x-icon "access plus 1 month"
ExpiresByType image/jpeg "access plus 4 weeks"
ExpiresByType image/png "access plus 30 days"
ExpiresByType image/gif "access plus 43829 minutes"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
# Включаем кэширование css, javascript и текстовых файлоф на одну неделю
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 604800 seconds"
ExpiresByType application/javascript "access plus 604800 seconds"
ExpiresByType application/x-javascript "access plus 604800 seconds"
# Включаем кэширование html и htm файлов на один день
ExpiresByType text/html "access plus 43200 seconds"
# Включаем кэширование xml файлов на десять минут
ExpiresByType application/xhtml+xml "access plus 600 seconds"
# Нестандартные шрифты сайта
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
</ifModule>
Если тебе не нравятся ошибки из PageSpeed Insights