Regular Expressions - Study Mode

[#1] Which one of the following functions is used to search a string?
Correct Answer

(A) preg_match

Explanation

Solution: The function returns 1 if search was successful else returns 0.

[#2] Which one of the following preg PHP function is used to do a find and replace on a string or an array?
Correct Answer

(A) preg_replace()

[#3] Which one of the following preg PHP functions is used to take a string, and put it in an array?
Correct Answer

(B) preg_split()

Explanation

Solution: The string is broken up into different values in the array based upon your input.

[#4] Which one of the following is not a preg PHP function?
Correct Answer

(C) preg_matchall

Explanation

Solution: The function preg_matchall does not exist. preg_match_all is a preg function.

[#5] Parameter flags was added in which version of PHP?
Correct Answer

(D) PHP 4.3