menu

PHP Basics


1. Which of the following is used to check if a variable is an array in PHP?

is_array()

array()

isArray()

none of the above


2. Which of the following is used to replace a substring in a string in PHP?

str_replace()

replace()

substr_replace()

replace_substr()


3. Which of the following is used to check if a variable is a string in PHP?

is_string()

string()

isString()

none of the above


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

include()

require()

both A and B

neither A nor B


5. Which of the following is used to check if a variable is an object in PHP?

is_object()

object()

isObject()

none of the above


6. Which of the following is used to get the length of a string in PHP?

strlen()

strlength()

length()

none of the above


7. Which of the following is used to check if a variable is a float in PHP?

is_float()

float()

isFloat()

none of the above


8. Which of the following is used to remove the last element from an array in PHP?

array_push()

array_pop()

array_shift()

array_unshift()


9. Which of the following is not a valid data type in PHP?

String

Integer

Boolean

Double


10. Which of the following is used to add an element to the beginning of an array in PHP?

array_push()

array_pop()

array_shift()

array_unshift()