menu

PHP Basics


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

array_push()

array_pop()

array_shift()

array_unshift()


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

isset()

empty()

null()

unset()


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

str_replace()

replace()

substr_replace()

replace_substr()


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

strtolower()

tolowercase()

lcstring()

none of the above


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


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

$my_var

$MyVar

$_myvar

$my-var


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

is_string()

string()

isString()

none of the above


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

strlen()

strlength()

length()

none of the above


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

setcookie()

createcookie()

set_cookie()

create_cookie()


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

==

=

===

!=