PHP MCQ Questions and Answers

Take Exam

PHP MCQ Questions with Answers help candidates strengthen their programming fundamentals and web development logic through objective-style practice. These PHP programming questions and answers are essential for cracking technical interviews and online coding assessments conducted by top recruiters like TCS, Infosys, Cognizant, and Wipro. Each question tests key PHP concepts such as syntax, data types, arrays, functions, form handling, and error management. Practicing these programming MCQs not only enhances problem-solving speed but also builds confidence for real-time technical evaluations. Whether you are preparing for placement drives, semester exams, or web development roles, this PHP MCQ collection with explanations and solutions PDF will help you master PHP efficiently. Begin your programming test practice online now and ace your upcoming PHP interview round.

PHP MCQ

Showing 10 of 130 questions

101. what is the return value of this substr function? <?php $rest = substr("abcdef", -1); $rest = substr("abcdef", 0, -1); ?>

  • f,abcde
  • a,fedcb
  • b,abcdef
  • a,abcde
Show Answer Report

102. Assume that your php file 'index.php' in location c:/apache/htdocs/phptutor/index.php. If you used basename($_SERVER['PHP_SELF']) function in your page, then what is the return value of this function ?

  • phptutor
  • phptutor/index.php
  • index.php
  • /index.php
Show Answer Report

103. $x="display"; ${$x.'_result'} (); ?> Above program will call the function display_result()

  • False
  • True
  • Parser Error
  • None of the above
Show Answer Report

104. All variables in PHP start with which symbol?

  • !
  • $
  • &
  • %
Show Answer Report

105. Father of PHP?

  • Larry Wall
  • Rasmus Lerdorf
  • James Gosling
  • Guido Van Rossum
Show Answer Report

106. In PHP the error control operator is _______

  • .
  • *
  • @
  • &
Show Answer Report

107. $str="3dollars"; $a=20; $a+=$str; print($a); ?> Output ?

  • 23dollars
  • 203dollars
  • 320dollars
  • 23
Show Answer Report

108. <?php function zz(& $x) { $x=$x+5; } ?> $x=10; zz($x); echo $x;

  • 5
  • 0
  • 15
  • 10
Show Answer Report

109. <?php echo $_SERVER['REMOTE_ADDR']; ?>

  • shows the IP address of the local system
  • shows the IP address of the visitor
  • shows the IP address of the webserver
  • None of the above
Show Answer Report

110. <?php $x=dir("."); while($y=$x->read()) { echo $y." " } $y->close(); ?> What is the following output?

  • display all folder names
  • display a folder content
  • display content of the all drives
  • Parse error
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test