NYCPHP Meetup

NYPHP.org

[nycphp-talk] equal (==) vs identical (===) and casting

Konstantin Rozinov krozinov at gmail.com
Mon Feb 23 23:59:56 EST 2009


Hey guys,

Some more questions.

1. Is there a significant speed difference between the equal operator
(==) and the identical operator (===)?  Should I even be concerned
about this?  For example, if I know a variable will be of type INT
100% of the time, and I pass it to a function which expects the
variable to an INT, should I use even use === inside the function when
doing comparisons?  Or is using === in this case just a waste of time?

2. What's the best way to cast?  For example, is it best to use (int)
$variable or intval($variable)?

Thanks again,
Konstantin



More information about the talk mailing list