bobl61 Posted June 28, 2023 Share Posted June 28, 2023 PHP Deprecated: Implicit conversion from float 0.1322222222222222 to int loses precision in sig.php on line 407, referer: hlstats.php?mode=playerinfo&player=1 PHP Deprecated: Implicit conversion from float 1.15 to int loses precision in sig.php on line 410, referer: hlstats.php?mode=playerinfo&player=8 line 407 $hours += floor($timestamp / 3600 % 24); line 410 $min = floor($timestamp / 60 % 60); Program is HlstatX. Server: XAMPP 8.2.4 (PHP 8.2.4). OS Windows 11 sig.txt Quote Link to comment Share on other sites More sharing options...
requinix Posted June 28, 2023 Share Posted June 28, 2023 Okay. And? Quote Link to comment Share on other sites More sharing options...
bobl61 Posted June 28, 2023 Author Share Posted June 28, 2023 The forum signature does not work... Quote Link to comment Share on other sites More sharing options...
requinix Posted June 28, 2023 Share Posted June 28, 2023 1 hour ago, bobl61 said: The forum signature does not work... Sure it does. I can't tell why you attached a sig.txt file to your post though. Quote Link to comment Share on other sites More sharing options...
kicken Posted June 29, 2023 Share Posted June 29, 2023 From the manual: Quote Operands of modulo are converted to int before processing. So when you're dividing your timestamp variable, you get a floating point number due to the values not dividing evenly. Attempting to use % on that result causes PHP to convert it to an integer instead, loosing whatever fractional value existed in the process. In the past, this happened silently. Now there's the notice about it to highlight the potential bug. Convert your floating point value to an integer value yourself explicitly to remove the error. You can do this in that code by just changing the floor function to only operate on the division instead of the whole expression. $hours += floor($timestamp / 3600) % 24; $min = floor($timestamp / 60) % 60; 1 Quote Link to comment Share on other sites More sharing options...
bobl61 Posted June 30, 2023 Author Share Posted June 30, 2023 I was just going to post back that I got the sig to work, but the player online time didn't match the sig. Your code works perfectly 😉 Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.