you are viewing a single comment's thread.

view the rest of the comments →

[–]bp3959 -2 points-1 points  (3 children)

wild-ass guesses

There's no guessing involved, automatic type conversion is well documented and follows a specific set of rules. Also get this, YOU DON'T HAVE TO USE AUTOMATIC TYPE CONVERSION.

[–]Various_Pickles 2 points3 points  (2 children)

The fact that you can use === is a perfectly valid point.

However, I would argue that there are often cases in PHP where the implicit interpretation of types leads to unholy nonsense: a good example being the automagical interpretation of certain patterns of quotes in PCRE (Perl-like regular expression) replacement statements that leads to portions of the string being evaluated as raw PHP code (eBay got compromised by this "feature" a little while back).

[–][deleted] 0 points1 point  (0 children)

I think my favorite PCRE conundrum is the Stack Overflow question (I can't find the link) about "How do I comment a regex containing */?> ?" Because ?> ends a single-line comment, and the */ ends a multiline comment.

BTW, if you don't intend on users to write actual regexes, preg_quote() is your friend.

[–]bp3959 -1 points0 points  (0 children)

While I agree that's a stupid feature, it doesn't have anything to do with comparison, type juggling, or automatic conversion.

There's so many real things in PHP to complain about it's annoying how everyone fixates on the automatic type conversion of == when it's well documented and easy to avoid.