Files
EasySoft-ZenTaoPMS/lib/zin/utils/flat.func.php
T
2023-07-25 17:42:27 +08:00

21 lines
419 B
PHP

<?php
declare(strict_types=1);
namespace zin\utils;
function flat($array, $prefix = '', $separator = '.')
{
$result = array();
foreach($array as $key => $value)
{
if(is_array($value))
{
$result = array_merge($result, flat($value, $prefix . $key . $separator));
}
else
{
$result[$prefix . $key] = $value;
}
}
return $result;
}