menu

PHP Basics


1. 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()


2. Which of the following is used to loop through an array in PHP?

for loop

foreach loop

while loop

None of the above


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

include()

require()

both A and B

neither A nor B


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

echo()

print()

var_dump()

all of the above


5. Which of the following is used to test if a variable is empty in PHP?

isset()

empty()

null()

unset()


6.

What does PHP stand for?

Personal Home Page

Preprocessor Hypertext Page

PHP Hypertext Preprocessor

Preprocessor Hypertext Processor


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

array_push()

array_pop()

array_shift()

array_unshift()


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

//

#

/*

//


9. Which of the following is used to sort an array in ascending order in PHP?

sort()

asort()

ksort()

none of the above


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

isset()

empty()

defined()

none of the above