PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
What does that say? Well, first, both variables ($sec and $Sub2Secs['services.email.compose']) are of the same type (double). Also, both variables have the same value. So why the heck does PHP return "true" to the negation of the equality? I mean, is like if PHP returned false for "7.11 == 7.11".
Maybe I'm missing something really simple... And I hope so
I solved it by converting both comparing values to 'strings'. Would this be the correct approach?
On the other hand, I don't know why in heaven's sake aren't the numbers stored the way they should. It's like when people learning math miss a solution by a decimal, and say, "But it's only a decimal!", yeah well, you're wrong.
I solved it by converting both comparing values to 'strings'. Would this be the correct approach?
Yes, depending on how you create the strings. If you let the strings be of unlimited length, then it might not always work, but formatting the strings at the number of useful digits "east" of the decimal point should always work.
On the other hand, I don't know why in heaven's sake aren't the numbers stored the way they should.
Well, remember the computer only has 1's and 0's to work with. Given that limitation, I think computers do a superb job of storing floating point numbers.