numbers in page show “inf” till switch tabs

I have a problem showing the converted number from USD To BTC using API.
On Price page I have 3 Tabs (LifeTime , Monthly, Yearly)(Switchable) Each Tab Has 2 Tables (Basic, Professional).
For Each Tab, I use API to convert and show the BTC price (Both usd&btc Need to be Shown).

the problem is at first touch when the page is loaded (Monthly Tab is activated by default) the BTC value shows as (inf) instead of (0.00031) Number for example. when I switch btw tabs BTC Prices display normally at should it be in all tabs.
how I show normal BTC price in the first Load.
enter image description here

here is my API code to Create a Rate.


<?php 

$url='https://bitpay.com/api/rates';
$json=json_decode( file_get_contents( $url ) );
$dollar=$btc=0;

foreach( $json as $obj ){
    if( $obj->code=='USD' )$btc=$obj->rate;
    
}

Calculate BTC price based on Plans dollar price and exchange rate.

$mi_m = $plan["price_monthly"] / $btc;
$mi_y = $plan["price_yearly"] / $btc;
$mi_lt= $plan["price_lifetime"] / $btc;?>

Show BTC Price (front)

 <div class="h3 text-center mb-0"
  data-pricing-monthly="<?php echo $plan['free'] ? e('Free') : (round($mi_m, 7) .' BTC') ?>"
  data-pricing-yearly="<?php echo $plan['free'] ? e('Free') : (round($mi_y, 7) . ' BTC ') ?>"
  data-pricing-lifetime="<?php echo $plan['free'] ? e('Free') : (round($mi_lt, 7).'BTC') ?>">
      <span class="price"><?php echo $plan['free'] ? e('Free') : (round($plan["price_" . $default] / $btc_rate, 7) . ' BTC') ?></span>
 
</div>

Show USD Price (front)

 <div class="h1 text-center mb-0" 
 data-pricing-monthly="<?php echo $plan['free'] ? e('Free') : HelpersApp::currency(config('currency'), $plan["price_monthly"]) ?>"
 data-pricing-yearly="<?php echo $plan['free'] ? e('Free') : HelpersApp::currency(config('currency'), $plan["price_yearly"]) ?>" 
 data-pricing-lifetime="<?php echo  $plan['free'] ? e('Free') : HelpersApp::currency(config('currency'), $plan["price_lifetime"]) ?>">
     <span class="price"><?php echo $plan['free'] ? e('Free') : HelpersApp::currency(config('currency'), $plan["price_".$default]) ?></span></div>
  

Codes Related To Tabs and other elements.

<div class="pricing row no-gutters">
    <?php foreach($plans as $id => $plan): ?>
        <div class="<?php echo $class ?>">
            <div class="card bg-section-primary card-pricing text-center mx-1">
                <div class="card-header py-5 border-0">
                    <?php if($plan['icon']): ?>
                        <span class="icon icon-lg bg-primary text-white rounded-circle icon-shape mb-3"><i class="<?php echo $plan['icon'] ?>"></i></span>
                    <?php endif ?>
                    <span class="d-block h5 mb-4"><?php ee($plan['name']) ?></span>


(Codes related To Price)

      
                    <?php echo $plan['description'] ? '<span class="d-block text-muted mt-3">'.$plan['description'].'</span>': '' ?>
                    <?php if($plan['planurl'] == "#"):?>
                        <span class="btn bg-secondary text-dark mt-3 d-block"><strong><?php echo $plan['plantext'] ?></strong></span>
                    <?php else: ?>
                        <a href="<?php echo $plan['planurl'] ?>" class="btn btn-primary mt-3 shadow checkout d-block"><?php echo $plan['plantext'] ?></a>
                    <?php endif?>
                </div>
                <div class="card-body border-top rounded-bottom p-4 position-relative">
                    <ul class="list-unstyled mb-4 text-left">
                        <li><span data-toggle="tooltip" title="<?php ee('Number of short links allowed.') ?>"><?php ee("Short links") ?></span><span class="float-right font-weight-700"><?php echo $plan["urls"] == "0" ? '<i class="fa fa-infinity"></i>' : number_format($plan["urls"]) ?></span></li>
                        <li><span data-toggle="tooltip" title="<?php ee('Total clicks allowed over a period') ?>"><?php ee("Link Clicks") ?></span><span class="float-right font-weight-700"><?php echo $plan["clicks"] == "0" ? '<i class="fa fa-infinity"></i>' : number_format($plan["clicks"]).'/'.e('mo') ?></span></li>
                        <li><span data-toggle="tooltip" title="<?php ee('Amount of time statistics are kept for each short link.') ?>"><?php ee("Data Retention") ?></span><span class="float-right font-weight-700"><?php echo $plan["retention"] == "0" ? '<i class="fa fa-infinity"></i>' : $plan["retention"].' '.e('days') ?></span></li>
                        <li><span data-toggle="tooltip" title="<?php ee("Choose a custom alias instead of a randomly generated one.") ?>"><?php ee("Custom Aliases") ?></span><span class="float-right"><?php echo $plan["permission"]->alias->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'  ?></span></li>
                        <li><span data-toggle="tooltip" title="<?php ee("Target and redirect visitors based on their country or state.") ?>"><?php ee("Geo Targeting") ?></span><span class="float-right"><?php echo $plan["permission"]->geo->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'  ?></span></li>
                        <li><span data-toggle="tooltip" title="<?php ee("Target and redirect visitors based on their device.") ?>"><?php ee("Device Targeting") ?></span><span class="float-right"><?php echo $plan["permission"]->device->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'  ?></span></li>
                        <li><span data-toggle="tooltip" title="<?php ee("Target and redirect visitors based on their language.") ?>"><?php ee("Language Targeting") ?></span><span class="float-right"><?php echo isset($plan["permission"]->language) && $plan["permission"]->language->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'  ?></span></li>
                        <li>
                            <span data-toggle="tooltip" title="<?php ee('Convert your followers by creating beautiful pages that group all of your important links on the single page.') ?>"><?php ee("Bio Profiles") ?></span>
                            <span class="float-right font-weight-700">
                                <?php if(isset($plan["permission"]->bio) && $plan["permission"]->bio->enabled): ?>
                                    <?php echo ($plan["permission"]->bio->count == "0" ? '<i class="fa fa-infinity"></i>' : $plan["permission"]->bio->count) ?>
                                <?php else: ?>
                                    <i class="fa fa-times text-danger"></i>
                                <?php endif ?>
                            </span>
                        </li>
                        <li>
                            <span data-toggle="tooltip" title="<?php ee('Easy to use, dynamic and customizable QR codes for your marketing campaigns. Analyze statistics and optimize your marketing strategy and increase engagement.') ?>"><?php ee("QR Codes") ?></span>
                            <span class="float-right font-weight-700">
                                <?php if(isset($plan["permission"]->qr) && $plan["permission"]->qr->enabled): ?>
                                    <?php echo ($plan["permission"]->qr->count == "0" ? '<i class="fa fa-infinity"></i>' : $plan["permission"]->qr->count) ?>
                                <?php else: ?>
                                    <i class="fa fa-times text-danger"></i>
                                <?php endif ?>
                            </span>
                        </li>
                        <li>
                            <span data-toggle="tooltip" title="<?php ee('Create a custom landing page to promote your product or service on forefront and engage the user in your marketing campaign.') ?>"><?php ee("Custom Landing Page") ?></span>
                            <span class="float-right font-weight-700">
                            <?php if(isset($plan["permission"]->splash) && $plan["permission"]->splash->enabled): ?>
                                <?php echo ($plan["permission"]->splash->count == "0" ? '<i class="fa fa-infinity"></i>' : $plan["permission"]->splash->count) ?>
                            <?php else: ?>
                                <i class="fa fa-times text-danger"></i>
                            <?php endif ?>
                            </span>
                        </li>
                        <li>
                            <span data-toggle="tooltip" title="<?php ee('Use our overlay tool to display unobtrusive notifications, polls or even a contact on the target website. Great for campaigns.') ?>"><?php ee("CTA Overlays") ?></span>
                            <span class="float-right font-weight-700">
                            <?php if(isset($plan["permission"]->overlay) && $plan["permission"]->overlay->enabled): ?>
                                <?php echo ($plan["permission"]->overlay->count == "0" ? '<i class="fa fa-infinity"></i>' : $plan["permission"]->overlay->count) ?>
                            <?php else: ?>
                                <i class="fa fa-times text-danger"></i>
                            <?php endif ?>
                            </span>
                        </li>
                        <li>
                            <span data-toggle="tooltip" title="<?php ee('Add your custom pixel from providers such as Facebook and track events right when they are happening.') ?>"><?php ee("Event Tracking") ?></span>
                            <span class="float-right font-weight-700">
                            <?php if(isset($plan["permission"]->pixels) && $plan["permission"]->pixels->enabled): ?>
                                <?php echo ($plan["permission"]->pixels->count == "0" ? '<i class="fa fa-infinity"></i>' : $plan["permission"]->pixels->count) ?>
                            <?php else: ?>
                                <i class="fa fa-times text-danger"></i>
                            <?php endif ?>
                            </span>
                        </li>
                        <li>
                            <span data-toggle="tooltip" title="<?php ee('Invite your team members and assign them specific privileges to manage links, bundles, pages and other features.') ?>"><?php ee("Team Members") ?></span>
                            <span class="float-right font-weight-700">
                            <?php if(isset($plan["permission"]->team) && $plan["permission"]->team->enabled): ?>
                                <?php echo ($plan["permission"]->team->count == "0" ? '<i class="fa fa-infinity"></i>' : $plan["permission"]->team->count) ?>
                            <?php else: ?>
                                <i class="fa fa-times text-danger"></i>
                            <?php endif ?>
                            </span>
                        </li>
                        <li>
                            <span data-toggle="tooltip" title="<?php ee("Easily add your own domain name for short your links and take control of your brand name and your users' trust.") ?>"><?php ee("Branded Domains") ?></span>
                            <span class="float-right font-weight-700">
                            <?php if(isset($plan["permission"]->domain) && $plan["permission"]->domain->enabled): ?>
                                <?php echo ($plan["permission"]->domain->count == "0" ? '<i class="fa fa-infinity"></i>' : $plan["permission"]->domain->count) ?>
                            <?php else: ?>
                                <i class="fa fa-times text-danger"></i>
                            <?php endif ?>
                            </span>
                        </li>
                        <li>
                            <span data-toggle="tooltip" title="<?php ee("Group & organize your links.") ?>"><?php ee("Channels") ?></span>
                            <span class="float-right font-weight-700">
                            <?php if(isset($plan["permission"]->channels) && $plan["permission"]->channels->enabled): ?>
                                <?php echo ($plan["permission"]->channels->count == "0" ? '<i class="fa fa-infinity"></i>' : $plan["permission"]->channels->count) ?>
                            <?php else: ?>
                                <i class="fa fa-times text-danger"></i>
                            <?php endif ?>
                            </span>
                        </li>
                        <?php if($features = plug('feature')): ?>
                            <?php foreach($features as $feature): ?>
                                <?php if(isset($plan["permission"]->{$feature['slug']}) && $plan["permission"]->{$feature['slug']}->enabled): ?>
                                    <?php if($feature['count'] != false): ?>
                                        <li><span data-toggle="tooltip" title="<?php echo $feature['description'] ?>"><?php echo $feature['name'] ?></span>
                                            <span class="float-right font-weight-700"><?php echo $plan["permission"]->{$feature['slug']}->count == '0' ? '<i class="fa fa-infinity"></i>' : $plan["permission"]->{$feature['slug']}->count ?></span>
                                        </li>
                                    <?php else: ?>
                                        <li><span data-toggle="tooltip" title="<?php echo $feature['description'] ?>"><?php echo $feature['name'] ?></span><span class="float-right"><i class="fa fa-check text-success"></i></span></li>
                                    <?php endif ?>
                                <?php else: ?>
                                    <li><span data-toggle="tooltip" title="<?php echo $feature['description'] ?>"><?php echo $feature['name'] ?></span><span class="float-right"><i class="fa fa-times text-danger"></i></span></li>
                                <?php endif ?>
                            <?php endforeach ?>
                        <?php endif ?>                        
                        <li><span data-toggle="tooltip" title="<?php ee("Group your links and visualize aggregate data.") ?>"><?php ee("Campaigns & Link Rotator") ?></span><span class="float-right"><?php echo $plan["permission"]->bundle->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'  ?></span></li>
                        <li><span data-toggle="tooltip" title="<?php ee("Use our various domains to generate short links.") ?>"><?php ee("Multiple Domains") ?></span><span class="float-right"><?php echo $plan["permission"]->multiple->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'  ?></span></li>
                        <li><span data-toggle="tooltip" title="<?php ee("Add parameters such as UTM to the short link.") ?>"><?php ee("Custom Parameters") ?></span><span class="float-right"><?php echo $plan["permission"]->parameters->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'  ?></span></li>
                        <li><span data-toggle="tooltip" title="<?php ee("Rotate links using the same short link. Great for A/B testing.") ?>"><?php ee("A/B Testing & Rotator") ?></span><span class="float-right"><?php echo isset($plan["permission"]->abtesting) && $plan["permission"]->abtesting->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'  ?></span></li>
                        <li><span data-toggle="tooltip" title="<?php ee("Set a date or number to clicks to expire short links") ?>"><?php ee("Expiration") ?></span><span class="float-right"><?php echo isset($plan["permission"]->expiration) && $plan["permission"]->expiration->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'  ?></span></li>   
                        <li><span data-toggle="tooltip" title="<?php ee("Limit number of clicks per short link") ?>"><?php ee("Click Limitation") ?></span><span class="float-right"><?php echo isset($plan["permission"]->clicklimit) && $plan["permission"]->clicklimit->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'  ?></span></li>
                        <li><span data-toggle="tooltip" title="<?php ee("Remove branding on Bio Pages and Custom Splash Pages") ?>"><?php ee("Remove Branding") ?></span><span class="float-right"><?php echo isset($plan["permission"]->poweredby) && $plan["permission"]->poweredby->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'  ?></span></li>  
                        <li><span data-toggle="tooltip" title="<?php ee("Imports link via CSV.") ?>"><?php ee("Import Links") ?></span><span class="float-right"><?php echo isset($plan["permission"]->import->enabled) && $plan["permission"]->import->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>' ?>  </span></li>
                        <li><span data-toggle="tooltip" title="<?php ee("Export clicks & visits.") ?>"><?php ee("Export Data") ?></span><span class="float-right"><?php echo $plan["permission"]->export->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>' ?>  </span></li>
                        <li><span data-toggle="tooltip" title="<?php ee('Use our powerful API to build custom applications or extend your own application with our powerful tools.') ?>"><?php ee("Developer API"); ?></span><span class="float-right"><?php echo $plan["permission"]->api->enabled ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>'  ?></span></li>
                        <li><span data-toggle="tooltip" title="<?php ee("No advertisement will be shown when logged or in your links.") ?>"><?php ee("Advertisement-Free") ?></span><span class="float-right"><?php echo !$plan["free"]  ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i>' ?></span></li>
                        <?php echo $plan["permission"]->custom  ? '<li>'.$plan["permission"]->custom.'<span class="float-right"><i class="fa fa-check text-success"></i></span></li>' : '' ?>
                    </ul>                    
                </div>
            </div>
        </div>
    <?php endforeach ?>
</div>

it should be normal Number in any conditions

New contributor

Ali Haseli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật