Lines Matching defs:array
13 * Print recursively an array as an HTML list
14 * @param array $toPrint
16 * @return string - an array as an HTML list or $content if given as variable
18 public static function formatAsHtmlList(array $toPrint, &$content = ""): string
44 * Delete from an array recursively key
46 * @param array $array
49 public static function filterArrayByKey(array &$array, $pattern)
51 foreach ($array as $key => &$value) {
53 unset($array[$key]);
61 public static function addIfNotSet(array &$array, $key, $value)
63 if (!isset($array[$key])) {
64 $array[$key] = $value;
69 * @param $array
70 * @return int|string|null - the last key of an array
74 public static function array_key_last(&$array)
76 // move the internal pointer to the end of the array
77 end($array);
78 $key = key($array);
80 reset($array);
85 * @param array $flatArray - the returned flat array
86 * @param array|string $value - the value to return as a flat array
88 public static function toFlatArray(array &$flatArray, $value)
100 * @param array $default
101 * @param array $overwrite
102 * @return array
104 public static function mergeByValue(array $default, array $overwrite): array
109 public static function formatAsString(array $array): string
111 return Json::createFromArray($array)->toPrettyJsonString();