how to hide the div card if API data is empty

Hi everyone i am trying to get Data from Api ,some of them will display empty means there is not any data right but the div card still displaying so i am here to seek for help which i want to hide the div card if it is empty

function getRoom($room){
        $rooms= array();
        $img = "";
        $name = "";
        $description = "";

        $rooms['img'] = $img;
        $rooms['name'] = $name;
        $rooms['description'] = $description;
        $rooms['address'] = $address;

return $rooms;
}


function getRoomCard($room){
        if (empty($room)){
            echo "No trace currently found";
          }
       
        return "
        <div class='col-md m-1'>
            <div class='card h-100'>
                <img class='card-img-top' src='{$room['img']}' alt='Card image cap' style='width:100%;height:180px;background-size: cover;'>
        
                <div class='card-body'>            
                    <h3 class='card-title'>{$room['name']}</h3>
                    <h5='card-text description'>description : {$room['description ']}</h5>
                    <h5='card-text description'>Address: {$room['address']}</h5>
                </div>
        
            </div>
        </div>
        
        ";  
  
    }