Filter the array according callback

@param array $arr The array to be used
@param callable $callback Function fired in array elements
@return array The array filtered
1327
public static function filter(array $arr, callable $callback): array
    {
        $arrResult = [];

        foreach ($arr as $index => $value) {
            if ($callback($value, $index) === true) {
                $arrResult[] = $value;
            }
        }

        return $arrResult;
    }
1024553
public static function map(array $arr, callable $callback): array
    {
        $arrResult = [];

        foreach ($arr as $index => $value) {
            $arrResult[] = $callback($value, $index);
        }

        return $arrResult;
    }
1329778
public static function map(array $array, callable $callback, $recursive = false)
    {
        $results = [];

        foreach ($array as $key => &$value) {
            if ($recursive && is_array($value)) {
                $results[$key] = static::map($value, $callback, $recursive);
            } else {
                $results[$key] = $callback($value, $key);
            }
        }

        return $results;
    }
1238081
public function filter($callback = null)
    {
        $test = array_filter($this->data, $callback);
        $clone = clone $this;
        return $clone->reset($test);
    }
250555
protected function setArray($name, callable $callback = null)
    {
        return $this->field(Type::TARRAY, $name, $callback);
    }
1321626
public static function where($array, \Closure $callback)
        {
            $filtered = array();

            foreach ($array as $key => $value) {
                if (call_user_func($callback, $key, $value)) {
                    $filtered[$key] = $value;
                }
            }

            return $filtered;
        }
868074
protected static function filter($items, callable $callback = null)
    {
        if ($callback) {
            return array_filter($items, $callback, ARRAY_FILTER_USE_BOTH);
        }

        return array_filter($items);
    }
1090519
async function filter (arr, callback) {
  const fail = Symbol('filter')
  return (await Promise.all(arr.map(async item => (await callback(item)) ? item : fail))).filter(i => i !== fail)
}
893213
public static final function make(array $Keys, callable $Callback = null): array {
		return Arr::combine($Keys, is_callable($Callback) ? Arr::each($Keys, function () use ($Callback){
			return call_user_func($Callback, func_get_arg(1)); }) : []);
	}
446148
public function map(callable $callback): ArrayCollection
    {
        $items = [];

        foreach ($this->items as $key => $value) {
            $items[$key] = $callback($value, $key);
        }

        return new static($items);
    }
212331
public function filter(callable $callback) : self
    {
        $entries = array_filter($this->getItems()->getArrayCopy(), $callback);
        $this->getItems()->exchangeArray($entries);
        return $this;
    }
422067
private function _sort(callable $callback = null) : array
    {
        $values = $this->getValues();
        if ($callback){
            usort($values, $callback);
        }
        else{
            sort($values);
        }
        return $values;
    }
483760
public static function only(array $arr, callable $callback): bool
    {
        $arrLength = 0;

        foreach ($arr as $index => $value) {
            if ($callback($value, $index) === true) {
                $arrLength++;
            }
        }

        return $arrLength === 1;
    }
1269918
private static function array_filter($arr, $values, $inverse = false)
    {
        if (!is_array($values)) {
            $values = explode(',', $values);
        }

        $result = array();
        $keep   = array_flip((array)$values);

        foreach ($arr as $key => $val) {
            if ($inverse != isset($keep[strtolower($val)])) {
                $result[$key] = $val;
            }
        }

        return $result;
    }
22674
public function filter(callable $callback): self
    {
        $collection = Factory::create();
        $index      = 0;
        foreach ($this->items as $key => $value) {
            if ($callback($value, $key, $index++)) {
                $collection->set($key, $value);
            }
        }

        return $collection;
    }
1324609
public static function filter(array $array = [], Closure $closure = null): array
    {
        if ($closure) {
            $result = [];

            foreach ($array as $key => $value) {
                if (call_user_func($closure, $value)) {
                    $result[] = $value;
                }
            }

            return $result;
        }

        return __::compact($array);
    }
217215
public function containsCallback(callable $callback)
	{
		// Normalize the callback
		$pc = new ProgrammableCallback($callback);
		$callback = $pc->getCallback();
		foreach ($this->items as $filter)
		{
			if ($callback === $filter->getCallback())
			{
				return true;
			}
		}

		return false;
	}