Zend PHP 5.3 Certification Exam


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
  • Question 13/25

    Consider a string in the following format:

    
    a*bcd/a.d
    
    You want to perform regular expression in this string; however, you are unable to do this since the string contains special characters. You can make this string PCRE compatible if you convert this string in the following format:
    
    a\*bcd\/a\.d
    
    Which of the following functions will you use to accomplish the task into a single call?



  • .

    Answer option C is incorrect. The preg_split() function splits the given string by using a regular expression.

    Answer option B is incorrect. The preg_match() function is used to perform a match by using a regular expression.

    Answer option D is incorrect. The explode() function is a PHP string function that takes a string and splits it into separate elements of an array, using the argument provided as delimiter. Its syntax is as follows:

    1. explode(separator,string,limit)

    where separator specifies where to break the string, string is the string to split, limit specifies the maximum number of array elements to return.

    Reference: PHP 5 Manual, Contents: "preg_quote()"
Back
Next