You think you know PHP. Quiz Results!

With 400+ answers here are the results. First I want to thank you for participating in the quiz and congrats for the 16 users that answered correctly to all the questions!

1. What will be the output of the following code?

echo date('Y-m-d', strtotime('-1 month ago'));
  • Error
  • One month ago from the current date and time
  • One month in the future from the current date and time correct answer (ref)

Answers of the first question

2. Is it possible to extend an interface with an abstract class?

  • Yes correct answer (ref)
  • No
Answers of the second question

3. What is the output of the following code?

$arr = array(1 => 10, "1" => 20); 
echo count($arr);
  • Error
  • 0
  • 1 correct answer (ref)
  • 2
Answers of the third question

4. What is the output of the following code?

$str = "hello world"; echo $str{1};
  • An error
  • h
  • e correct answer (ref)
  • ello world
Answers of the fourth question

5. What is the output of the following code?

$str = "foo Bar"; 
echo ucwords($str);
  • Foo bar
  • Foo Bar correct answer (ref)
  • FOO BAR
  • foo bar
Answers of the fifth question

Leave a Reply

Your email address will not be published. Required fields are marked *