📜 ⬆️ ⬇️

PHP Test

In one of the previous topics in the comments I saw an interesting problem test:

if ($ x == 1) echo "1";
if ($ x == 2) echo "2";
if ($ x == 3) echo "3";
in which case on the screen I will see "123"

The answer is trivial (true)
')
The task is interesting, but I suggest modifying it for php5 programmers. She is not so beautiful, but more useful for assessing knowledge ...

// @ todo: put code here
echo "\ n", $ x [0] === 0? 'yes': 'no';
echo "\ n", $ x [0] === 1? 'yes': 'no';
echo "\ n", $ x [0] === 2? 'yes': 'no';
echo "\ n", $ x [0] === 3? 'yes': 'no';
...
Conclusion

yes
yes
yes
yes

Source: https://habr.com/ru/post/20044/


All Articles