A non well formed numeric value encountered - what does this mean?

a non well formed numeric value encountered number_format
a non well formed numeric value encountered laravel
php 7.2 a non well formed numeric value encountered
a non well formed numeric value encountered php excel
a non well formed numeric value encountered microtime
"a non well formed numeric value encountered" opencart
a non well formed numeric value encountered dompdf
zurmo a non well formed numeric value encountered

I have the following message flagging up when notices are turned on:

Notice: A non well formed numeric value encountered

Does this mean the value expected was not a simple integer? The line referenced is showing this:

$per = ($raw>0?ceil((($raw/$cast)/5)*100):0).'%';

To reproduce:

var_dump("14" / "3 votes");

(demo)

... prints a warning since PHP/7.1:

Notice: A non well formed numeric value encountered in /in/8dsH7 on line 3 float(4.6666666666667)

So they apparently added new checks to prevent errors.

Maths with numbers is reliable and well defined. Maths with arbitrary text is not. Or, do you think this makes sense:

var_dump("pink" * "apples");

int(0)

Notice "A non well formed numeric value encountered" in PHP 7.1 , Since PHP 7.1 there is a notice when casting non numeric string to number https:/​/wiki.php.net/rfc/invalid_strings_in_arithmetic. This line gives  A non well formed numeric value encountered. Ask Question. Asked 8 years, 11 months ago. Active today. Viewed 323k times. 115. I have a form that passes two dates (start and finish) to a PHP script that will add those to a DB. I am having problems validating this. I keep getting the following errors.

Are you entering it for an obfuscated code contest or something? :-D . I can't reproduce the notice message, but if you split the code up into separate lines, perhaps you will find out which part of the formula causes the message.

Why do you check if $raw > 0? If $raw is zero, then $per will simply end up being zero anyway.

If you're trying to avoid a division by zero error, then you need to be checking $cast, not $raw.

$per = 0;
if ($cast > 0) {
    $per = ($raw / $cast) / 5 * 100;
}
$per .= "%";

As a final comment, from this fragment of code, it's not clear why you divide by five. It's just a magic number. It would be clearer to make this a constant or variable; at the very least, leave a comment what it is.

Good luck!

[SOLVED] A non well formed numeric value ?? (PHP7?), upgrade, I believe A non well formed numeric value encountered in I have to do everything in my power to make sure that we have clean mean 'not a single electron wasted' code for our website. Constant drivel from  [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;

Thanks very much for your comments, but after looking at this with fresh eyes, I was able to look abit further into the code, and it dawned on me what was happening.

As asked above, I dumped the values of $raw and $cast, which were returned as:

string(2) "14" string(7) "3 votes"

So clearly, the '3 votes' is supposed to be a number, or the calculation isn't going to work. I had a look at the line above, which read:

$cast = (get_post_meta($id, '_kksr_casts', true)?get_post_meta($id, '_kksr_casts', true):'0').' votes';

Bingo. I removed the ending 'votes' output, leaving just the number. And the message disappears. I still want the original text to be outputted though, so I found the next line after 606 contained this:

$row = $avg . ' (' . $per . ') ' . $cast;

So I just added 'votes' on the end of this line, which results in the correct output in the WP Admin, and the error now gone.

Seems fixed, and a pull request created. Thanks for all your help guys.

Error: A non well formed numeric value encountered, I am getting the above error, which references two things: helpers.php, which is a bunch of helper functions, and CartController.php. A non well formed numeric value encountered (6) $_GET ['start_date'] is not numeric is my bet, but an date format not supported by strtotime. You will need to re-format the date to a workable format for strtotime or use combination of explode / mktime.

T217087 Error "A non well formed numeric value encountered" (from , Error "A non well formed numeric value encountered" (from ImageMap) ImageMap does not currently prescribe what should happen if one of the coordinates but I mean the behaviour of "negative becomes positive" is what we had up until  [sat May 30 07:23:36 2009] [error] [client 127.0.0.1] PHP Notice: A non well formed numeric value encountered in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\topsongs.php on line 234 Here is an example of the code I am having a problem with:

PHP Notice: A non well formed numeric value encountered in · Issue , Short description of the issue PHP 7 is throwing notices these now when trying PHP Notice: A non well formed numeric value encountered in #31 This is an intended usage, because $width < 1 means you are specifying a  Dismiss Join GitHub today. GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.

PHP Notice: A non well formed numeric value encountered in srdb , GitHub is home to over 50 million developers working together to host and PHP Notice: A non well formed numeric value encountered in the class definition in C:\xampp\htdocs\whatsnew\search\srdb.class.php on line 755. All of the values are converted to integers so any floats, percentages, etc. get scaled naively. This was true of the previous code as well so I didn't change that behavior. I think a possible solution here is to use is_numeric instead of ctype_digit in the check. It would permit floats even though they'll be cast to integers as the code does

Comments
  • Add var_dump($raw, $cast); right before this line.
  • string(2) "14" string(7) "3 votes" - Sounds like they shouldn't be strings I take it?
  • Hmm I removed the 'votes' output from the variable, and now the error disappears. Maybe that's all it needed.