PHP Multiple Choice Questions with Answers

(1) What is the output of the following program ?

	<?php
	$str = "Learn PHP and \c";
	echo $str;
	?>   
	
[A] Fatal error
[B] Compilation error
[C] Learn PHP and \c
[D] prints 15

Comment

Answer: Option [C]

Unknown escape sequence \c is ignored

(2) The var_dump() function displays
[A] the binary value of a variable
[B] any PHP value in a human readable form
[C] the whether a variable is empty or not
[D] none of these above

Comment

Answer: Option [B]

DOWNLOAD CURRENT AFFAIRS PDF FROM APP

Article and Schedule Quiz Start Test!
(3) Which is true about var_dump() function?
[A] var_dump() loops infinitely
[B] var_dump() cuts off loop afetr getting same element two times
[C] var_dump() cuts off loop after getting the same element three times
[D] var_dump() cuts off loop after getting the same element five times

Comment

Answer: Option [C]
(4) Which function is used to remove whitespace from the start of the string ?
[A] trim()
[B] strim()
[C] rtrim()
[D] ltrim()

Comment

Answer: Option [D]
(5) ucfirst() function changes case
[A] of the first character of the string
[B] of the first character of each words
[C] of the first uppercase character appeared
[D] of the first lowercase character appeared

Comment

Answer: Option [A]

Take Mock Tests

Missiles Mock Test Start Test!
SSC MTS Mock Test Start Test
IBPS CLERK MOCK TEST Start Test
SSC MTS 2022 JULY 26 Shift 1 (ENGLISH) Start Test!
SSC GD Previous Year Paper 2021 Nov 17 Shift - I (Hindi) Start Test!
SSC CGL Tier - 1 PYP 2022 April 21 Shift- 1 (ENGLISH) Start Test!
MPSC PAPER I MOCK TEST 1 (ENGLISH) Start Test!
IB Security Assistant Mock test 1 (english) Start Test!
UP POLICE CONSTABLE MOCK TEST 1 Start Test!
DELHI POLICE CONSTABLE MOCK TEST 1 (HINDI) Start Test!

Chapters