mirror of
https://github.com/igorsimdyanov/php8.git
synced 2025-08-06 11:10:42 +00:00
21 lines
385 B
PHP
21 lines
385 B
PHP
<?php
|
|
$extensions = [
|
|
'php' => 'PHP',
|
|
'py' => 'Python',
|
|
'rb' => 'Ruby',
|
|
'js' => 'JavaScript'
|
|
];
|
|
|
|
function print_array(string $item, string $key) : void
|
|
{
|
|
echo "$key: $item< /br>" . PHP_EOL;
|
|
}
|
|
function walk(array $array, callable $callback) : void
|
|
{
|
|
foreach($array as $key => $value) {
|
|
$callback($value, $key);
|
|
}
|
|
}
|
|
|
|
walk($extensions, 'print_array');
|