Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

wordpress

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 '';
}
like image 518
Odofin Caleb Avatar asked Jul 23 '14 09:07

Odofin Caleb


1 Answers

$fields['price']='8, 9858';
echo number_format((float)$fields['price']);

use (float) to parse correct way

like image 97
Faruk Omar Avatar answered Sep 27 '22 22:09

Faruk Omar