如何在php中回显foreach循环的值

时间:2016-09-28 11:18:58

标签: php

我已经编写了一个foreach循环来显示最小和最大利率,但我没有得到如何回应它的价值。在这里,我只使用了最低利率。但我想回应 只有最低利率,当最小值和最大值相同时,两个值在最小和最大利率不匹配时显示。

                  <?php if(count($json['resultList']) > 0): ?>
      <?php 
        foreach ($json['resultList'] as $key=>$value) {
            if($json["resultList"][$key]["interestRateMin"] == $json["resultList"][$key]["interestRateMax"]){
                $interest = $json["resultList"][$key]["interestRateMin"];
            }
            else{
                $interest = $json["resultList"][$key]["interestRateMin"].' - '.$json["resultList"][$key]["interestRateMax"];
}
                echo '
  <div class="cr-content">                
                <div class="bank-rates">
      <ul>
   <li><div class="innr-spl" style="padding: 5px 0;"><span style="display:block;"><img src="'.$json["resultList"][$key]["imageUrl"].'"></span>
   <span class="hide">Muthoot Finance</span>      
   </div></li>


   <li><div class="innr-spl2">'.$json["resultList"][$key]["interestRateMin"].'%'.'</div></li>
   <li><div class="innr-spl2">60</div> </li>
   <li class="hide"><div class="innr-spl3 view-detail1" id="'.$key.'"><i class="fa fa-chevron-circle-down" aria-hidden="true"></i>View Datails</div> </li>
      </ul>
      <div style="clear:both"></div>
                            <div class="bannerin" id="ban_'.$key.'"> 
      <ul class="details" id="details1">
        <li><i class="fa fa-thumbs-o-up" aria-hidden="true"></i> Maximum Loan Amount : '.$json["resultList"][$key]["loanEligibility"].'</li>
        <li><i class="fa fa-thumbs-o-up" aria-hidden="true"></i> Max Tenure (In Years) : '.$json["resultList"][$key]["tenure"].'</li>
        <li><i class="fa fa-thumbs-o-up" aria-hidden="true"></i> Interest Rate Type : '.$json["resultList"][$key]["rateType"].'</li>

      </ul>
      </div>
    </div>
    </div>

                ';
                $i++;
        }

    ?>
<?php endif;?>

0 个答案:

没有答案