menu

PHP Syntax


1. What is the correct syntax to pass arguments to a function in PHP?

function_name(arguments)

function_name(arguments;)

function_name(arguments,)

function_name(arguments);


2. Which of the following is used to terminate a loop in PHP?

exit

continue

break

return


3. Which of the following is used to define a constant in PHP?

define()

const()

var()

let()


4. Which of the following is used to call a function in PHP?

function_name();

call function_name();

function call(function_name);

call(function_name);


5. Which of the following is used to define a constant in PHP?

define('Constant_name', 'value');

constant Constant_name = value;

Constant_name = value;

all of the above


6. Which of the following is used to create an object of a class in PHP?

Class_name = new Class();

new Object = Class_name();

new Class_name();

Object = new Class_name;


7. Which of the following is used to access a property of an object in PHP?

object_name->property_name;

object_name.property_name;

object_name[property_name];

object_name->(property_name);


8. Which of the following is used to execute a block of code at least once and repeatedly as long as a condition is true in PHP?

if statement

switch statement

for loop

do-while loop


9. Which of the following is used to compare two values for equality in PHP?

==

=

===

!=


10. What is the correct syntax to create an array in PHP?

$array = [1, 2, 3];

$array = array(1, 2, 3);

$array = {1, 2, 3};

$array = (1, 2, 3);