А при чем тут версия интерпретатора?Что-то из статуса deprecated перешло в removed. Какие-то ошибки вместо warning начали выдавать error.
$a = '1d 35m';
if (preg_match('/^(?:(?<days>\d+)d)?\s*(?:(?<hours>\d+)h)?\s*(?:(?<minutes>\d+)m)?\s*(?:(?<seconds>\d+)s)?$/', $a, $matches)) {
$resultSec = intval($matches['days'] ?? '') * 86400 + intval($matches['hours'] ?? '') * 3600
+ intval($matches['minutes'] ?? '') * 60 + intval($matches['seconds'] ?? '');
echo $resultSec;
} else {
echo 'error';
}
// 88500
const makeTimes = (interval, elapsedTimeMin) => {
const deltaTimeMin = Math.ceil(elapsedTimeMin / 30) * 30;
const startTime = new Date(interval.start);
const endTime = new Date(interval.end);
if (startTime.getSeconds() > 0) {
startTime.setSeconds(60);
}
startTime.setMinutes(Math.ceil(startTime.getMinutes() / 30) * 30);
const result = [];
while (startTime <= endTime) {
result.push(startTime.toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit' }));
startTime.setMinutes(startTime.getMinutes() + deltaTimeMin);
}
return result;
}
makeTimes({start: 'Tue Aug 30 2022 09:00:00', end: 'Tue Aug 30 2022 16:30:00'}, 20);
// Array(16) [ "09:00", "09:30", "10:00", "10:30", "11:00", "11:30", "12:00", "12:30", "13:00", "13:30", … ]
makeTimes({start: 'Tue Aug 30 2022 09:00:00', end: 'Tue Aug 30 2022 16:30:00'}, 40);
// Array(8) [ "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00" ]
C D | X
0 0 | 1
0 1 | 0
1 0 | 0
1 1 | 1
Получаем, X = !C!D + CDX A | Y
0 0 | 0
0 1 | 1
1 0 | 1
1 1 | 1
Получаем Y = !XA + X!A + XA = !XA + X!A + XA + XA = (!XA + XA) + (X!A + XA) = A + Xconst replaces = {
zero: '0',
one: '1',
two: '2',
plus: '+',
minus: '-',
};
const wordedMath = (expr) => {
const re = RegExp(`(${Object.keys(replaces).join('|')})`, 'g');
const value = eval(
expr.toLowerCase().replaceAll(re, (s) => replaces[s])
);
return Object.keys(replaces).find((e) => replaces[e] == value) ?? value;
}
in_array(mixed $needle, array $haystack, bool $strict = false): bool
strripos(string $haystack, string $needle, int $offset = 0): int|false
array_reduce(array $array, callable $callback, mixed $initial = null): mixed
array_map(?callable $callback, array $array, array ...$arrays): array
Encoding with a 128-bit key length is used, but you can extend it up to 256 bits by modifying the source.