menu

PHP Syntax


1. Which of the following is used to call a method of an object in PHP?

object_name.method_name();

call object_name.method_name();

object_name(call method_name());

object_name->method_name();


2. Which of the following is used to define a class in PHP?

define class Class_name {}

Class Class_name {}

new Class Class_name {}

class Class_name {}


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

function_name();

call function_name();

function call(function_name);

call(function_name);


4. What is the correct syntax to include a file in PHP?

include "filename";

require "filename";

include_once "filename";

all of the above


5. Which of the following is used to import classes or namespaces into the current namespace in PHP?

namespace Namespace_name;

use Namespace_name;

define Namespace_name;

all of the above


6. What is the correct syntax to define a function in PHP?

function function_name()

function_name()

function function_name(parameters)

function function_name(parameters)


7. What is the correct syntax to access an element in an array in PHP?

$array[element];

$array[element]

array[element];

array[element]


8. Which of the following is used to include a PHP file in another PHP file in PHP?

require('filename.php');

include('filename.php');

require_once('filename.php');

all of the above


9. Which of the following is used to define a namespace in PHP?

namespace Namespace_name;

use Namespace_name;

define Namespace_name;

all of the above


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

.

+

-

*