Learn PHP MCQs

Prepare PHP MCQs (Multiple choice Questions) for exam and job interviews.

What does PHP stand for?

1) Private Home Page

2) Personal Home Page

3) Professional Home Page

4) Programming Home Page

Answer : Option 2

Which of the following is a PHP variable?

1) $variable

2) variable

3) var_variable

4) &variable

Answer : Option 1

How do you create a function in PHP?

1) functionName()

2) create functionName()

3) function functionName()

4) define functionName()

Answer : Option 3

Which superglobal array holds information about headers, paths, and script locations?

1) $_POST

2) $_GET

3) $_SESSION

4) $_SERVER

Answer : Option 4

How do you end a PHP statement?

1) .

2) ;

3) end

4) }

Answer : Option 2

Which of the following is the correct way to include a file in PHP?

1) include "filename";

2) require[filename];

3) getfile(filename);

4) require file("filename");

Answer : Option 1

Which version of PHP introduced namespaces?

1) PHP 4

2) PHP 5.3

3) PHP 5.4

4) PHP 7.0

Answer : Option 2

What is the correct way to start a session in PHP?

1) session_begin();

2) start_session();

3) session_start();

4) begin_session();

Answer : Option 3

Which of the following is used to concatenate two strings in PHP?

1) .

2) +

3) &

4) &&

Answer : Option 1

Which function is used to find the length of a string in PHP?

1) strlen()

2) length()

3) strlength()

4) str_len()

Answer : Option 1