|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-06-18 09:23 UTC] colder@php.net
[2008-06-18 09:27 UTC] wittstruck at mediafinanz dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 05:00:01 2025 UTC |
Description: ------------ I'm casting a string to a double; afterwards the casted result does differ from the original string, but comparing them does not work properly and leads to a wrong bool. strcmp works, though. Reproduce code: --------------- <?php $stringAmount = '2008-06-13 14:24:00'; $doubleAmount = (double) $stringAmount; echo 'doubleAmount: ' . $doubleAmount . ' stringAmount: ' . $stringAmount; if ($doubleAmount != $stringAmount) { echo '<br/>' . $doubleAmount . ' is not equal to' . $stringAmount; } else { echo "<br/> both are equal"; } ?> Expected result: ---------------- doubleAmount: 2008 stringAmount: 2008-06-13 14:24:00 2008 is not equal to2008-06-13 14:24:00 Actual result: -------------- doubleAmount: 2008 stringAmount: 2008-06-13 14:24:00 both are equal