RockLobsterInc\FormDataTree
scalar_to_map()
Converts a scalar value into a map with a specified key. The original array structure will be preserved.
Хуков нет.
Возвращает
array. Array.
Использование
scalar_to_map( $key, $value ): array;
- $key(строка) (обязательный)
- Map key.
- $value(разное) (обязательный)
- Original value.
Код scalar_to_map() scalar to map CF7 6.2.4.1
function scalar_to_map(string $key, mixed $value): array
{
if (is_scalar($value)) {
return [$key => $value];
}
if (is_array($value)) {
return array_map(static function ($item) use ($key) {
return scalar_to_map($key, $item);
}, $value);
}
return [];
}