Filters an array on suffixed associative keys.
@param   array   $array          the array to filter.
@param   string  $suffix         suffix to filter on.
@param   bool    $remove_suffix  whether to remove the suffix.
@return  array
342022
public static function filter_suffixed($array, $suffix, $remove_suffix = true)
    {
        $return = [];
        foreach ($array as $key => $val) {
            if (preg_match('/'.$suffix.'$/', $key)) {
                if ($remove_suffix === true) {
                    $key = preg_replace('/'.$suffix.'$/', '', $key);
                }
                $return[$key] = $val;
            }
        }
        return $return;
    }
1044584
public static function trimRecursive(array $array)
    {
        /*
         * No elements?
         * Nothing to do
         */
        if (empty($array)) {
            return [];
        }

        $result = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $result[$key] = self::trimRecursive($value);

                continue;
            }

            if (is_string($value)) {
                $value = trim($value);
            }

            $result[$key] = $value;
        }

        return $result;
    }
1340126
private function removeValue(&$array, $key)
    {
        $keys = explode('.', $key);

        while (count($keys) > 1) {
            $key = array_shift($keys);

            if ( ! isset($array[$key]) || ! is_array($array[$key])) {
                return;
            }

            $array =& $array[$key];
        }

        unset($array[array_shift($keys)]);
    }
614631
public static function arrayPrefixValue($array, $prefix)
    {
        array_walk($array, function (&$item1, $key, $prefix) {
            $item1 = $prefix . $item1;
        }, $prefix);

        return $array;
    }
392515
protected function filterArray(array $array): array
	{
		$newArray = [];

		foreach($array as $row)
		{
			$newArray[] =  (is_array($row)) ? $row[0] : $row;
		}

		return $newArray;
	}
1339283
public static function filterByKeys($array, array $keysInc = null, array $keysExc = null)
    {
        if ($keysInc !== null) {
            $array = array_intersect_key($array, array_flip($keysInc));
        }
        if ($keysExc) {
            $array = array_diff_key($array, array_flip($keysExc));
        }
        return $array;
    }
1236638
public static function flattenArray(array $array, $prefix = '')
    {
        $result = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $result = $result + self::flattenArray($value, $prefix.$key.'.');
            } else {
                $result[$prefix.$key] = self::normalizeValue($value);
            }
        }

        return $result;
    }
3309
public static function remove(&$array, $keys)
    {
        $original = &$array;
        $keys     = (array) $keys;

        if (!Arr::accessible($array)) {
            return;
        }
        if (count($keys) === 0) {
            return;
        }

        foreach ($keys as $key) {
            if (Arr::exists($array, $key)) {
                unset($array[$key]);

                continue;
            }

            // Clean up before each pass
            $array = &$original;
            $parts = explode('.', $key);

            while (count($parts) > 1) {
                $part = array_shift($parts);
                if (isset($array[$part]) && is_array($array[$part])) {
                    $array = &$array[$part];
                } else {
                    continue 2;
                }
            }

            unset($array[array_shift($parts)]);
        }
    }
1305043
public static function Remove( array $array, int $index ) : array
   {

      if ( $index < 0 || $index >= \count( $array ) )
      {
         return $array;
      }

      if ( $index == 0 )
      {
         return \array_slice( $array, 1 );
      }

      if ( $index + 1 == \count( $array ) )
      {
         return \array_slice( $array, 0, -1 );
      }

      $neu = \array_slice( $array, 0, $index );

      return \array_merge( $neu, \array_slice( $array, $index + 1 ) );

   }
858813
public static function remove(array $array, string $key): array
    {
        // Extract key/path.
        $keyLast = Str::last($key, '.');
        $key = Str::removeLast($key, '.');

        // If found, remove element.
        $arrayElement = &self::dataByPath($array, $key, false, 'not.found');
        if ($arrayElement !== 'not.found') {
            if (array_key_exists($keyLast, $arrayElement)) {
                unset($arrayElement[$keyLast]);
            }
        }

        return $array;
    }
475632
public static function remove(array &$array, string $dottedKey)
    {
        if (isset($array[$dottedKey])) {
            $value = $array[$dottedKey];
            unset($array[$dottedKey]);

            return $value;
        }

        $k = explode('.', $dottedKey, 2);

        return isset($k[1])
            ? self::remove($array[$k[0]], $k[1])
            : null;
    }
1153113
protected function getOnlyStringKeys(array $array)
    {
        $allowed = array_filter(array_keys($array), function ($key)
        {
            return ! is_int($key);
        });

        return array_intersect_key($array, array_flip($allowed));
    }
5134
public function filter(&$array) {
        while(list($key, $var) = each($array)) {
            if ($key != 'argc' && $key != 'argv' && (strtoupper($key) != $key || '' . intval($key) == "$key")) {
                if (is_string($var)) {
                    $array[$key] = stripslashes($var);
                }
                if (is_array($var))  {
                    $array[$key] = $this->filter($var);
                }
            }
        }
        return $array;
    }
248986
public function prefixArrayKeys($prefix, $array)
    {
        return array_combine(array_map(function ($key) use ($prefix) {
            return $prefix.$key;
        }, array_keys($array)), array_values($array));
    }
920431
private function trimArray($array)
    {
        foreach ($array as $key => $value) {
            // Do not attemp to trim array variables, boolean variables, or the proxy password
            // Trimming a boolean value (as a string) may not produce the expected output, so pass it through as-is
            if (!is_array($value) && !is_bool($value) && $key !== 'proxy_password') {
                $array[$key] = trim($value);
            }
        }
        return $array;
    }
381874
public static function deleteKeys(array &$array, array $unwantedKey)
    {
        self::unsetKeys($array, $unwantedKey);

        foreach ($array as &$value) {
            if (\is_array($value)) {
                self::deleteKeys($value, $unwantedKey);
            }
        }
    }
49774
public static function removeFromArray(&$array, $keychain)
    {
        if (!is_array($array)) {
            $array = [];
        }
        if (!is_array($keychain)) {
            $keychain = [$keychain];
        }

        $headKey = array_shift($keychain);
        if (empty($keychain)) {
            //last
            unset($array[$headKey]);
        } else {
            //not last
            if (isset($array[$headKey])) {
                self::removeFromArray($array[$headKey], $keychain);
            }
        }
    }