Two Laptop Bag
The moose likes PHP and the fly likes equivalence relation, makes no sense here Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Languages » PHP
Reply Bookmark "equivalence relation, makes no sense here" Watch "equivalence relation, makes no sense here" New topic
Author

equivalence relation, makes no sense here

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 712
Hi, I'm confused...

10 === 10.0 is FALSE, because different data types (int and float)

But when I do..
$a = 10;
$b = 10.0;

$a === $b is TRUE, but they have different data types, don't they?

I did echo gettype(10.0); and this says double.

Can anyone explain, I need to clear this up. Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56205
    
  13

Please KeepItDown


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 712
Nevermind, I found an error in my code, $b = &$a, which made the types the same.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: equivalence relation, makes no sense here
 
Similar Threads
Why i am getting different output!!!!!
How to best convert for example 2.29 -> 2.3
about a Math.sqrt()
explain why the following will compile
== question