Reputation: 728
I've got a bit of code the refuses to run, giving the error;
[ErrorException]
A non well formed numeric value encountered
I've read an awful lot about it, but all of the solutions seem to have dealt with people not using number_format
, date
or strtotime
correctly.
My code can be as simple as the below whilst giving the error;
$plan == 'Event';
if($plan !== 'Event') {
$cost_of_report = $cost_of_report * 2;
}
The line $cost_of_report = $cost_of_report * 2;
works on its own.
I've echoed out gettype($plan)
and it is a string.
I'm using this in a Laravel artisan command with in Laravel 4.2 on PHP 5.6.31.
Does anyone have any idea what's wrong or what I can do to try and get this working?
Upvotes: 1
Views: 3638
Reputation: 308
Make sure you haven't converted $cost_of_report to number_format() before the calculation.
Try doing the calculations before converting to number_format()
Hope this helps.
Upvotes: 0
Reputation: 111829
I believe the problem here is not with $plan
but with $cost_of_report
. Make sure it's number
Upvotes: 2