this post was submitted on 15 Jan 2025
91 points (98.9% liked)

Programmer Humor

33162 readers
157 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

A small collection of WTF code snippets sorted by language.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 6 points 3 weeks ago (1 children)

Some of the examples seem to be more "unintuitive for newbies", but there are still some good ones in there

[โ€“] [email protected] 1 points 21 hours ago

Yeah, just check the PHP section!

My favourite is

var_dump(true == 'bob') . PHP_EOL;   // bool(true)
var_dump('bob' == 0) . PHP_EOL;   // bool(true)
var_dump(true == 0) . PHP_EOL;   // bool(false)