menu

PHP Basics


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

is_bool()

bool()

isBoolean()

none of the above


2. Which of the following is used to display the contents of an array in PHP?

echo()

print()

var_dump()

all of the above


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

isset()

empty()

defined()

none of the above


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

is_float()

float()

isFloat()

none of the above


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

strlen()

strlength()

length()

strlenof()


6. Which of the following is used to set a cookie in PHP?

setcookie()

createcookie()

set_cookie()

create_cookie()


7. Which of the following is used to split a string into an array in PHP?

split()

explode()

slice()

splitstring()


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

is_int()

integer()

isInteger()

none of the above


9. Which of the following is used to comment out a single line in PHP?

//

#

/*

//


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

array_push()

array_pop()

array_shift()

array_unshift()