Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

equivalence relation, makes no sense here

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64623
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please KeepItDown
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind, I found an error in my code, $b = &$a, which made the types the same.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic