PHP intermediate quiz quiz

Intermediate PHP quiz that cover common issues and solutions in PHP programming

This quiz is in PHP quiz collection.

Start quiz
  • 1.

    Which of the following is correct about preg_match() function?

  • 2.

    Which of the following method can be used to create a MySql database using PHP?

  • 3.

    Which of the following type of variables are sequences of characters, like 'PHP supports string operations.'?

  • 4.

    Which of the following is used to declare a constant?

  • 5.

    What will be printed?

    $var = '0';
    
    if ($var) {
        echo 'true';
    } else {
        echo 'false';
    }
  • 6.

    What will be the value of $var?

    $var = 1 / 2;
  • 7.

    How do we access the value of 'd' later?

    $a = array(
        'a',
        3 => 'b',
        1 => 'c',
        'd'
    );
  • 8.

    What will be printed?

    $a = array();
    
    if ($a == null) { 
      echo 'true';
    } else {
      echo 'false';
    }
  • 9.

    What will be printed?

    if (null === false) {
      echo 'true';
    } else {
      echo 'false';
    }
  • 10.

    What will be the value of $var below?

    $var = true ? '1' : false ? '2' : '3';
  • 11.

    What will be printed?

    if ('2' == '02') {   
      echo 'true';
    } else {
      echo 'false';
    }
  • 12.

    What will be printed?

    $a = array(
      null => 'a',
      true => 'b',
      false => 'c',
      0 => 'd',
      1 => 'e',
      '' => 'f'
    );
    
    echo count($a), "\n";
  • 13.

    In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:

  • 14.

    Which of the following function creates an array?

  • 15.

    Which of the following method of Exception class returns array of the backtrace?

© 2017 QuizBucket.org