Php Objective Questions with Answers for written test exams 21

Question 21
Which question will replace markup such as img=/smiley.png with
src=”/smiley.png”>?

A. print preg_replace(‘/img=(\w+)/’, ‘’, $text);

B. print preg_replace(‘/img=(\S+)/’, ‘’, $text);

C. print preg_replace(‘/img=(\s+)/’, ‘’, $text);

D. print preg_replace(‘/img=(\w)+/’, ‘’, $text);
Answers 21


Answer B is correct.The characters / and . are not matched by \w (which only

matches alphanumerics and underscores), or by \s (which only matches whitespace).

  







Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---