public static function array_filter_values($array, $params = [])
    {
        if (is_string($params)) {
            $params = array('with' => $params);
        }

        if (isset($params['with'])) {

            $data = array();

            foreach ($array as $key => $value) {
                if (preg_match('/' . $params['with'] . '/i', $value)) {
                    $data[$key] = $value;
                }
            }

            return $data;
        } else {
            return array_filter($array);
        }
    }
public static function array_filter_values($array, $params = [])
    {
        if (is_string($params)) {
            $params = array('with' => $params);
        }

        if (isset($params['with'])) {

            $data = array();

            foreach ($array as $key => $value) {
                if (preg_match('/' . $params['with'] . '/i', $value)) {
                    $data[$key] = $value;
                }
            }

            return $data;
        } else {
            return array_filter($array);
        }
    }
public static function array_filter_values ( $ array , $ params = [ ] ) { if ( is_string ( $ params ) ) { $ params = array ( 'with' => $ params ) ; } if ( isset ( $ params [ 'with' ] ) ) { $ data = array ( ) ; foreach ( $ array as $ key => $ value ) { if ( preg_match ( '/' . $ params [ 'with' ] . '/i' , $ value ) ) { $ data [ $ key ] = $ value ; } } return $ data ; } else { return array_filter ( $ array ) ; } }
Array filters with particular values

@example

array_filter_values(["test","dada"], "te")
=> will return only test

@param $array
@param array $params
@return array
@internal param null $c
Array filters with particular values