Skip to content

Commit

Permalink
правки
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasiliy-Makogon committed Oct 5, 2023
1 parent 0e4ab1b commit af37553
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,30 @@ string(75) "O:33:"Krugozor\Cover\Tests\NewTypeArray":2:{i:0;s:3:"PHP";i:1;s:5:"M

Пример:
```php
foreach ($data->get('langs') as $stack => $values) {
echo sprintf(
"<ul>%s (%s): %s</ul>\n",
$stack,
$values->count(),
$values->map(fn(string $value): string => "<li>$value</li>")->implode('')
$value = $data->get('langs')->mapAssociative(function (string $key, CoverArray $langs) {
return sprintf(
"\n<ul>\n %s (%s):\n%s\n</ul>",
$key,
$langs->count(),
$langs->map(fn(string $lang): string => " <li>$lang</li>")->implode(PHP_EOL)
);
}
})->implode('');
```
Результат:
```
<ul>backend (2): <li>PHP</li><li>MySql</li></ul>
<ul>frontend (5): <li>HTML</li><li>CSS1</li><li>JavaScript</li><li>CSS2</li><li>CSS3</li></ul>
string(190) "
<ul>
backend (2):
<li>PHP</li>
<li>MySql</li>
</ul>
<ul>
frontend (5):
<li>HTML</li>
<li>CSS1</li>
<li>JavaScript</li>
<li>CSS2</li>
<li>CSS3</li>
</ul>"
```

0 comments on commit af37553

Please sign in to comment.