Why does the result give INF?

0

This results in this: bitcoin INF 2299

I'm new to this. I'd appreciate your help.

?>

<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">

    <p class="price"><?php echo $product->get_price_html(); ?></p>

<?php

$coinId = bitcoin;
$json = \file_get_contents( "https://api.coinmarketcap.com/v1/ticker/{$coinId}" );
$coins = json_decode($json);

$calculo = $product->get_price()/$coins->price_usd;

?>

        <?php foreach ($coins as $coin) 
        { ?>

<p><?php echo $coin->id; ?> <?php echo $calculo; ?> <?php echo $product->get_price(); ?></p>

        <?php } ?>

</div>
    
asked by Andrés Navarro 09.08.2018 в 13:42
source

1 answer

0

this was the solution:

<?php
    //Una moneda -----------------------------------------------------------
    $coinId = ethereum;
    $json = \file_get_contents( "https://api.coinmarketcap.com/v1/ticker/{$coinId}" );
    $coins = json_decode($json);
    ?>

            <?php foreach ($coins as $ethereum) 
            { ?>
    <?php $precioethereum = $product->get_price()/$ethereum->price_usd; ?>

            <?php } ?>
    
answered by 11.08.2018 в 12:59