Via Tim Bray’s blog I found zestyping’s “Why PHP should never be taught”. In it he provides some interesting PHP code that will be difficult for beginners to understand.

1
$a = 0; $b = "eggs"; $c = "spam";

yields:

1
2
3
4
5
6
 a == b 
 b != c 
 a == c 
 a == d 
 b != d 
 c != d 

(Please note that d hasn’t been defined). In the comments, people freak out and tell him that this behaviour is defined in the documentation. I guess that makes it even worse.

Trying the same thing in Ruby:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
a = 0 
b = "eggs" 
c = "spam"

a == b => false

b == c => false

a == c => false

a == d NameError: undefined local variable or method 'd' for main:Object from (irb):7