0

I have migrated PHP 5.0 To PHP 7.2, I have retried to display values of variables but i got Warning: A Non-Numeric Value Encountered.

I have couples of variables and each variables have specific value something like.

$getProductPrice have 37.95 , $product_quanity= 4 and $productWeight = 1.5

I used following script for fix this but still getting same error.

$productWeight = $getProductData['weight'];
$product_quanity = $product_quanity;
$getProductPrice = $getProductData['price'];

if (is_numeric($getProductPrice) && is_numeric($product_quanity)) {
    $totalProductPrice +=  (int) $getProductPrice * (int) $product_quanity;
    $totalProductWeight +=  (int) $productWeight * (int) $product_quanity;
}

But it always return Warning: A Non-Numeric Value Encountered I have also tried to use is_float() and also tried to set all variables values as 0 before start loop but not work getting Warning.

Someone have any idea about this it's happened in PHP version 7.2 ?

Samir Sheikh
  • 2,283
  • 2
  • 19
  • 37

0 Answers0