From f8d743296580ccf17260505be0b5baee17ac82c6 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 11 Aug 2018 15:11:34 +1000 Subject: [PATCH] Added array_undot() helper --- src/helpers.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/helpers.php b/src/helpers.php index ef145a1..765efaa 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -12,4 +12,18 @@ if (! function_exists('is_json')) { return (json_last_error() == JSON_ERROR_NONE); } +} + +// Inverse of array_dot() +if (! function_exists('array_undot')) { + function array_undot($dotNotationArray) + { + $array = []; + + foreach ($dotNotationArray as $key => $value) { + array_set($array, $key, $value); + } + + return $array; + } } \ No newline at end of file