// type juggling concern
}
if ((int)$compare1 === (int)$compare2) {
// not type juggling
}Which one is more preferred in terms of security and performance? Have there been a benchmark test done on this kind of stuff?
in most of the cases, uses === instead of ==
Generally being stricter during programming has always better results at the end and cleaner code. So i think === is mostly better if u can afford it. But it doesn't make sense if u gonna type cast the variables before checking (string) then u r doing == again
Found answer for this?
It's a 2 year old post
Anyway, personally I would prefer the second one as it is more explicit what you are doing and expecting
isnt the test easy as hell? you just execute both comparisons timed a few thousand oder million times untill you see a difference in the times oO
or is there something i should know which could interfere regarding the php interpreter
I'm on detailed web assessment and source code review project , just validating vulnerability
then the question is still what you are trying to accomolish in said comparison
Обсуждают сегодня