I am trying to multiply two values in php which gives me the error A non well formed numeric value encountered
Code:
$value = 2.5/100;
$totalvalue = $value * $totalvalue;
echo $totalvalue;
I am trying to multiply two values in php which gives me the error A non well formed numeric value encountered
Code:
$value = 2.5/100;
$totalvalue = $value * $totalvalue;
echo $totalvalue;
I forgot to typecast.
$value = 2.5/100;
$totalvalue = $value * (float)$totalvalue;
echo $totalvalue;
Use the code below :-
$totalvalue = 1.0 ; //Set $totalvalue and typecast to float
$value = 0.0 ;
$value = 2.5/100;
$totalvalue = $value * $totalvalue;
echo "<br>".$totalvalue;