<?php
$dic1 = [
'@' => 'а',
'ἄ' => 'а',
'a' => 'а',
'6' => 'б',
'b' => 'б',
];
$dic2 = [
'а' => [
'@',
'ἄ',
'a',
],
'б' => [
'6',
'b',
],
];
echo 'dic1: ';
$dic1_iterations = 0;
foreach ($dic1 as $from => $to) {
$dic1_iterations++;
echo $from;
}
echo ' | iterations: ' . $dic1_iterations;
echo PHP_EOL;
echo 'dic2: ';
$dic2_iterations = 0;
foreach ($dic2 as $to => $from_arr) {
$dic2_iterations++; // тут лишняя итерация
foreach ($from_arr as $from) {
$dic2_iterations++;
echo $from;
}
}
echo ' | iterations: ' . $dic2_iterations;
dic1: @ἄa6b | iterations: 5
dic2: @ἄa6b | iterations: 7