Home / CSE MCQs / PHP MCQs :: PHP Basics

CSE MCQs :: PHP MCQs

  1. Which of the below statements is equivalent to $add += $add ?
  2. A.
    $add = $add
    B.
    $add = $add +$add
    C.
    $add = $add + 1
    D.
    $add = $add + $add + 1

  3. What will be the output of the following code?
    < ?php  function track() { static $count = 0; $count++; echo $count ; } track(); track(); track(); ?>
  4. A.
    123
    B.
    111
    C.
    000
    D.
    011

  5. What will be the output of the following PHP code?
    < ?php  $a = "clue"; $a .= "get"; echo "$a"; ?>
  6. A.
    get
    B.
    true
    C.
    false
    D.
    clueget

  7. What will be the output of the following PHP code?
    < ?php      $team = "arsenal";     switch ($team) {     case "manu":         echo "I love man u";     case "arsenal":         echo "I love arsenal";     case "manc":         echo "I love manc"; } ?>
  8. A.
    I love arsenal
    B.
    Error
    C.
    I love arsenalI love manc
    D.
    I love arsenalI love mancI love manu

  9. What will be the output of the following PHP code?
    < ?php      $num = 10;     echo 'What is her age? \n She is $num years old'; ?>
  10. A.
    What is her age? \n She is $num years old
    B.
    What is her age?
    She is $num years old
    C.
    What is her age? She is 10 years old
    D.
    What is her age?
    She is 10 years old