code: public static function flattenArrayIndexed($array)
      {
          if (!is_array($array)) {
              return (array) $array;
          }
  
          $arrayValues = [];
          foreach ($array as $k1 => $value) {
              if (is_array($value)) {
                  foreach ($value as $k2 => $val) {
                      if (is_array($val)) {
                          foreach ($val as $k3 => $v) {
                              $arrayValues[$k1 . '.' . $k2 . '.' . $k3] = $v;
                          }
                      } else {
                          $arrayValues[$k1 . '.' . $k2] = $val;
                      }
                  }
              } else {
                  $arrayValues[$k1] = $value;
              }
          }
  
          return $arrayValues;
      }
docs: Convert a multi-dimensional array to a simple 1-dimensional array, but retain an element of indexing.
  
  @param array $array Array to be flattened
  
  @return array Flattened array