Recently, I had a discussion with EnnoBigBenno, one of the friends over at senaeh.de about the merits of php (or lack thereof). I believe that a good and simple programming language can easily be parsed and understood by a human. This brought me to the idea, to create a small game of „True or False“ where you have to decide, what the php-interpreter thinks, is true or false. Simple as that. Count your correct answers and check you php-prowess.
Warning: This game is not for the faint of heart. And feel free to share your score in the comments.
1 of 37:
true == false
2 of 37:
"true" == "false"
3 of 37:
"true" == false
4 of 37:
true == "false"
5 of 37:
"true" == 0
6 of 37:
"true" + "5" == true
7 of 37:
"true"*5 == true
8 of 37:
"true" + "5" == "true"
9 of 37:
"true" + "5" == "true5"
10 of 37:
"5" + "true" == "5true"
11 of 37:
"5foo" == 5
12 of 37:
"5foo" == "5"
13 of 37:
"5foo" == "5" + "0"
14 of 37:
false - true == false
15 of 37:
"false" == 0
16 of 37:
"5,5" == 5
17 of 37:
"5.5" == 5
18 of 37:
"5 bottles of beer" - true == true
19 of 37:
"10 bottle of beer" - "5 bottles of beer" == true
20 of 37:
array() == false
21 of 37:
array(false) == false
Now enough with loose comparison. Let’s get on to strict comparison
22 of 37:
5 === round(5.2)
23 of 37:
5 === round(5)
24 of 37:
"5" + "2" === 7.0
25 of 37:
"5.0" + "2" === 7.0
26 of 37:
(Null + false) === 0
27 of 37:
(Null & false) === 0
28 of 37:
(Null && false) === 0
29 of 37:
"0123" + "0" === 123
30 of 37:
0123 + "0" === 123
31 of 37:
array(array()) == array(false)
32 of 37:
array(1.0 => false) == array("1.0" => false)
33 of 37:
"0123" == 0123
34 of 37:
"0x2" == 0x2
35 of 37:
"0" == "00"
36 of 37:
"0" == true
37 of 37:
"00" == true
So, how well did you do?
36/37 Correct Answers: You are a php genius.
30-35 Correct Answers: You might be the actual php interpreter.
20-30 Correct Answers: You got the gist of php.
10-19 Correct Answers: You might be an actual programmer.
1-9 Correct Answers: You should go back to haskell or lisp. And you know you want to.
0 Correct Answers: You are way beyond hope. I just do not know in which direction.
Share your score in the comments 🙂
17 😀