Jump to content

please help me


dickybella85

Recommended Posts

A non well formed numeric value encountered 
 

please help me for this

 

 
 

 

<?php
 
    $prix = number_format($prix, 2, '.', ' ');
    if($prix != 0)
    echo '<p class="p_prix_info_ann"><span class="vert">'. $language['page_ann_prix'] .' :</span> '. $param_gen['devise'] .' '. $prix .'</p>';
 
?>
 

 

Link to comment
https://forums.phpfreaks.com/topic/297029-please-help-me/
Share on other sites

For what it's worth, I was able to replicate the error with the following lines of code:

$number = ' 234234234 ';
print number_format($number, 2, '.', ' ') . '<br>';
 
The number_format() function doesn't seem to like spaces. Have you tried using var_dump() to see the exact value of $prix?
Link to comment
https://forums.phpfreaks.com/topic/297029-please-help-me/#findComment-1514960
Share on other sites

Good luck with that, cyberRobot. He's been asked several times already

 

I guess the error is from number_format()? The three lines you posted look ok. So it looks like $prix is not a number can you tell us how and where that variable is defined?

 

 

Ok. Well those two lines would not produce that error. Its is the line with number_format() producing that error.

 

It seems the value ($prix) you are giving number_format is not a number this why you are getting the error. How is $prix defined before that line?

 

 

Could you show us the code that defines $prix?

Link to comment
https://forums.phpfreaks.com/topic/297029-please-help-me/#findComment-1514970
Share on other sites

 $prix should be a numeric value which contains only numbers no special characters allowed.

   

For example :

 

$prix = 12345;  not as $prix = $12345

 

$prix = number_format($prix, 2, '.', ' ');

    if($prix != 0)

    echo '<p class="p_prix_info_ann"><span class="vert">'. $language['page_ann_prix'] .' :</span> '. $param_gen['devise'] .' '. $prix .'</p>';

 

 

which gives :  12 345.00 when $prix is 12345

Link to comment
https://forums.phpfreaks.com/topic/297029-please-help-me/#findComment-1515499
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.