Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm sure you've already seen this (it's been around a while), but if not, you'll find it amusing:

http://www.phpwtf.org/

Last I checked, it wasn't quite as good as wtfjs, but it looks like quite a few new surprises have been added rather recently.

Edit: Correction, there's only one new entry as of this year, which is a shame. :)



The first two I read aren't even WTF the worthy and are perfectly reasonable. Even in the classic fractal of bad design article, only 1/3 of it is actually valid.


I half agree, but I'd like to point out that the likely reason the curator of this site thinks of these as "WTFs" has more to do with PHP's (lack of?) consistency and it's relatively bizarre behavior when compared with saner languages.

The other thing to consider (looking at it again, particularly at the second example) is that there are some surprising side effects that can snag newcomers, depending on their background and whatever other languages they know.

Perhaps one of the drawbacks with programming PHP is that you become so desensitized to weirdly inconsistent/surprising behavior that there's almost nothing left to be surprised about.


It's nit-picky to the point of ridiculousness. Take the first example, even the title "Objects with __toString are not strings." is already WTF worthy. Of course objects with a __toString method are not strings! It means they can be converted to strings when unambiguously used as strings. Which is exactly what happens! The whole entry is stupid. The author even complains that PHP will issue an error if __toString doesn't return a string! I mean really.

Most other entries involve doing something bizarre with obviously undefined consequences and then marveling that PHP does it different than they expect. Or failing to understand PHP's basic rules and then again, on edge cases, marveling at weirdness of the perfectly logical result.

The "PHP protected and an assault" entry just fails to comprehend how access modifiers actually work with the classes.

There are real PHP WTF's but honestly they were all discovered 10 years ago. Probably 50% of all entries on the site are people misunderstanding how references work over and over and over.


I'll grant you that, although I get the impression it's largely someone wanting to have fun with oddities of the language. Although I wouldn't necessarily go as far as to claim that it's "marveling [sic] at the weirdness of the perfectly logical result"--there are some PHP behaviors that are just plain strange.

On the other hand, had you written "perfectly logical result (within the confines of PHP's idea of what's logical)," then I might be inclined to agree.

But yes, I made the mistake of linking the site without re-examining it. I recall seeing it first from HN some time ago (probably 2010ish) and thought it might have improved. I do believe I may have indicated its quality isn't on par with wtfjs.org, however. Take it as you will.


Weird, clicked the link, and my computer crashed. Opened it now, perfectly fine. Weird.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: