Warning: number_format() expects parameter 1 to be double, string given

I got this Error on my Page slider:

Warning: number_format() expects parameter 1 to be double, string given in /home/globalar/public_html/wp-content/themes/automotive_s1/includes/slider.php on line 30

<?php

    if $str = floatval($str); ($post->post_type == "gtcd") {
        the_title();
    if (isset( $fields['price'])) {
        echo ' | <span class="price_slider">'.'  '.$symbols['currency']; 
        echo number_format($fields['price']).'</span> ';
    } else { 
        echo '';
}

Related posts

Leave a Reply

3 comments

  1. You should check what value is inside $fields['price'].

    Just do:

    var_dump($fields['price']);
    

    It’s possible you have some spaces or , instead of .

  2. fix it with define other variabel.

    $tot=$row['total'];
    $total=number_format($tot,2);
    
    $tot2=$tot*1;
    $vat=number_format($tot2*10/100,2);
    

    maybe help