|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-02-28 21:43 UTC] ghetalion at ghetalion dot com
[2004-02-28 21:49 UTC] alindeman@php.net
[2004-02-29 03:24 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
Description: ------------ When attempting to take a float variable and typecasting it into an int, I receive a magnificent error that is unexplainable. Reproduce code: --------------- function TimeToText($timestamp) { $day = strftime("%d", $timestamp); $factor = $day/10; $factor = (int)(($factor- ((int)($factor)))*10); var_dump($factor); } Expected result: ---------------- int(3) Actual result: -------------- int(2) Instead of truncating all decimal places, converting a float into an int is changing the entire whole-number value!