mercredi 29 juin 2016

Want to Filter an array according to value

i have a variable $a='san-serif' and an array Font_list[] now i want only the arrays whose category is 'san-serif' i tried a lot of codes nothing seems working here is my code:-

public function filterFont() {

    $key = $_POST['key'];
    $url = "http://ift.tt/28ONRKg''";
    $result = json_decode(file_get_contents( $url ));
    $font_list = "";
    foreach ( $result->items as $font )
    {
        $font_list[] = [
            'font_name' => $font->family,
            'category' => $font->category,
            'variants' => implode(', ', $font->variants),
            // subsets
            // version
            // files
        ];
    }
    $filter = filter($font_list);

    print_r(array_filter($font_list, $filter));

}

Please help me :-(



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire