menu

Web Development With PHP


1. Which PHP function is used to remove whitespace from the beginning and end of a string?

trim()

rtrim()

ltrim()

strip()


2. Which PHP function is used to redirect the user to another web page?

header()

location()

redirect()

navigate()


3. Which of the following is NOT a valid comparison operator in PHP?

==

!=

<=>

><


4. Which PHP function is used to output text to the web page?

echo

print

printf

write


5. Which of the following is NOT a valid way to concatenate two strings in PHP?

$string1 . $string2

$string1 + $string2

$string1 .= $string2

$string1, $string2


6. Which PHP function is used to check if a file exists?

file_exists()

check_file()

exists_file()

file_check()


7. Which PHP function is used to generate a random number?

rand()

random()

randomize()

random_number()


8. Which of the following is NOT a valid data type in PHP?

boolean

integer

float

char


9. Which of the following is a superglobal variable in PHP?

$_SESSION

$_COOKIE

$_POST

All of the above


10. Which PHP function is used to get the current date and time?

time()

date()

datetime()

now()