echo arr[''];
function insertData($arr, $names, $path) {
$pathArr = explode('.', $path);
$lastKey = array_pop($pathArr);
foreach ($names as $lang => $value) {
$branch = &$arr[$lang];
foreach($pathArr as $pathPart) {
if(!isset($branch[$pathPart])) {
$branch = null;
break;
}
$branch = &$branch[$pathPart];
}
if(!$branch) continue;
if($lastKey === 'goods') {
if(!isset($branch['goods'])) $branch['goods'] = [];
$branch['goods'][] = $value;
} else if (!isset($branch[$lastKey])) {
$branch[$lastKey] = $value;
}
}
}
$mysqli = new mysqli("example.com", "user", "password", "database");
if ($mysqli->connect_errno) {
echo "Не удалось подключиться к MySQL: " . $mysqli->connect_error;
}
$res = $mysqli->query("SELECT 'выбора, чтобы угодить всем.' AS _msg FROM DUAL");
$row = $res->fetch_assoc();
echo $row['_msg'];
<?php echo addslashes($row['a_name']) ?>
foreach ($arr as $ind=>$usersBlock) {
$keys = [];
foreach ($usersBlock as $user) {
$key = $user['user_id'] . '#' . $user['date'];
list($hours, $minutes, $seconds) = explode(':', $user['time']);
$seconds += $minutes * 60 + $hours * 3600;
if(!isset($keys[$key])) {
$keys[$key] = $user;
$keys[$key]['seconds'] = $seconds;
} else {
$keys[$key]['seconds'] += $seconds;
}
}
$arr[$ind] = [];
foreach ($keys as $key => $value) {
$value['time'] = convertToTime($value['seconds']);
unset($value['seconds']);
$arr[$ind][] = $value;
}
}
function convertToTime($seconds) {
// Напишите конвертацию секунд в полноценное время сами
return $seconds;
}
new ErrorView($data)