$date = date("d.m.Y H:i", $date);
$date = '28.10.2020';
$timestamp = strtotime($date);
$shift = '1:10';
$hm = explode(':', $shift);
$timestamp += $hm[0] * 3600 + $hm[1] * 60;
$newDate = date('d.m.Y H:i', $timestamp);
var_dump($newDate);
// string(16) "28.10.2020 01:10"
BASS is free for non-commercial use. If you are a non-commercial entity (eg. an individual) and you are not making any money from your product (through sales, advertising, etc), then you can use BASS in it for free.
//переопределяю массив новыми размерамиС чего вы сделали такой вывод? Это просто получение значения из массива a по индексам row и col.
a[row][col];
Как решить проблему?Изучить, как создавать массив динамически.
$input = [
['id' => 1, 'name' => 'a'],
['id' => 2, 'name' => 'b'],
['id' => 3, 'name' => 'c'],
['id' => 4, 'name' => 'd'],
];
$replaceIds = [2 => 4];
$removeIds = array_values($replaceIds);
$result = array_map(
function($el) use ($replaceIds) {
if (array_key_exists($el['id'], $replaceIds)) {
return ['id' => $replaceIds[$el['id']], 'name' => $el['name']];
}
return $el;
},
array_filter(
$input,
function($el) use ($removeIds) {
return !in_array($el['id'], $removeIds);
}
)
);
print_r($result);
//Array(
// [0] => Array(
// [id] => 1
// [name] => a
// )
// [1] => Array(
// [id] => 4
// [name] => b
// )
// [2] => Array(
// [id] => 3
// [name] => c
// )
//)