menu

PHP Functions


1. Which PHP function is used to encode a URL?

urlencode()

encode_url()

url_encode()

encode()


2. Which PHP function is used to check if a variable is empty?

empty()

is_empty()

check_empty()

var_empty()


3. Which PHP function is used to calculate the absolute value of a number?

abs()

absolute()

val()

value()


4. Which PHP function is used to replace a portion of a string with another string?

str_replace()

replace()

string_replace()

swap()


5. Which PHP function is used to sort an array in ascending order?

sort()

ascending()

order()

arrange()


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

date()

time()

now()

datetime()


7. Which PHP function is used to redirect a user to a different URL?

header()

redirect()

location()

navigate()


8. Which PHP function is used to get the value of a specific cookie?

$_COOKIE[]

get_cookie()

cookie_value()

fetch_cookie()


9. Which PHP function is used to add elements to the end of an array?

array_push()

add()

insert()

push()


10. Which PHP function is used to round a number to the nearest integer?

round()

ceil()

floor()

int()