menu

PHP Basics


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

include()

require()

both A and B

neither A nor B


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

is_int()

integer()

isInteger()

none of the above


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

strlen()

strlength()

length()

strlenof()


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

array_push()

array_pop()

array_shift()

array_unshift()


5. Which of the following is used to test if two values are equal in PHP?

==

=

===

!=


6. Which of the following is used to redirect a user to a different page in PHP?

header()

redirect()

location()

navigate()


7. Which of the following is used to convert a string to lowercase in PHP?

strtolower()

tolowercase()

lcstring()

none of the above


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

is_string()

string()

isString()

none of the above


9. Which of the following is not a valid variable name in PHP?

$my_var

$MyVar

$_myvar

$my-var


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

isset()

empty()

defined()

none of the above