$value) { if (is_scalar($value)) { if ($prefix) { $arrays_to_merge[] = [ $prefix . '[' . $key . ']' => $value, ]; } else { $arrays_to_merge[] = [ $key => $value, ]; } } elseif ($value instanceof \CURLFile) { $arrays_to_merge[] = [ $key => $value, ]; } elseif ($value instanceof \CURLStringFile) { $arrays_to_merge[] = [ $key => $value, ]; } else { $arrays_to_merge[] = self::arrayFlattenMultidim( $value, $prefix ? $prefix . '[' . $key . ']' : $key ); } } $return = array_merge($return, ...$arrays_to_merge); } } elseif ($array === null) { $return[$prefix] = $array; } return $return; } /** * Array Flatten Multidim * * @deprecated Use ArrayUtil::arrayFlattenMultidim(). * @param $array * @param $prefix * @return array */ public static function array_flatten_multidim($array, $prefix = false) { return static::arrayFlattenMultidim($array, $prefix); } /** * Array Random * * @param $array * @return mixed */ public static function arrayRandom($array) { return $array[static::arrayRandomIndex($array)]; } /** * Array Random Index * * @param $array * @return int */ public static function arrayRandomIndex($array) { return mt_rand(0, count($array) - 1); } /** * Array Random * * @deprecated Use ArrayUtil::arrayRandom(). * @param $array * @return mixed */ public static function array_random($array) { return static::arrayRandom($array); } }