$arr1 = array(
'1' => array('1' => 'значение-1-ключ-1', '2' => 'значение-2-ключ-1'),
'2' => array('1' => 'значение-1-ключ-2', '2' => 'значение-2-ключ-2'),
'3' => array('1' => 'значение-1-ключ-3', '2' => 'значение-2-ключ-3'),
);
$result = [];
array_walk_recursive(
$arr1,
function ($value, $key) use (&$result) {
$index = count($result) ? array_key_last($result) + 1 : $key;
$result[$index] = $value;
}
);
var_dump($result);
array(6) {
[1]=>
string(29) "значение-1-ключ-1"
[2]=>
string(29) "значение-2-ключ-1"
[3]=>
string(29) "значение-1-ключ-2"
[4]=>
string(29) "значение-2-ключ-2"
[5]=>
string(29) "значение-1-ключ-3"
[6]=>
string(29) "значение-2-ключ-3"
}
$data = json_decode($json, true);
$data['group'] = array_reduce(
$data['group'],
function($res, $i) {
$res[$i['id']] = $i['value'];
return $res;
},
[]
);
{"group":{"12":"3","15":"1"}}
<?php
$current_user = wp_get_current_user();
$usermassive = get_field('your_manager', 'user_' . $current_user->ID);
echo '<ul>';
echo '<li>' . $usermassive['user_firstname'] . ' ' . $usermassive['user_lastname'] . '</li>';
echo '<li>' . $usermassive['user_email'] . '</li>';
echo '</ul>';
?>
<?php
$manager_id = $usermassive['ID'];
$manager_data = get_userdata($manager_id);
$manager_login = $manager_data -> user_login;
$tbl = array_fill(0, 20, []);
for ($i = 0; $i < 256; ++$i) { $tbl[intdiv($i, 100) + intdiv($i, 10) % 10 + $i % 10][] = $i; }
for ($i = 0; $i <= 19; ++$i) {
for ($j = 0; $j <= min(19, 28 - $i); ++$j) {
for ($k = max(0, 28 - 19 - $i - $j); $k <= min(19, 28 - $i - $j); ++$k) {
foreach($tbl[$i] as $v1) {
foreach($tbl[$j] as $v2) {
foreach($tbl[$k] as $v3) {
foreach($tbl[28 - $i - $j - $k] as $v4) {
echo $v1, '.', $v2, '.', $v3, '.', $v4, "\n";
}
}
}
}
}
}
}
<?php
function number_sum($num)
{
return array_sum(str_split($num));
}
$sum = 28;
for ($b1 = 1; $b1 < 256; $b1++) {
for ($b2 = 0; $b2 < 256; $b2++) {
for ($b3 = 0; $b3 < 256; $b3++) {
for ($b4 = 0; $b4 < 256; $b4++) {
if ((
number_sum($b1) +
number_sum($b2) +
number_sum($b3) +
number_sum($b4)
) == $sum) {
echo "$b1.$b2.$b3.$b4" . PHP_EOL;
}
}
}
}
}