1.

What will be the output if we replace the line $num = preg_grep(“/[0-5]/”, $number); with $num = preg_grep(“/[0-5]/”, $number, PREG_GREP_INVERT);?(a) Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5)(b) Array([2]=>two [3]=>three [4]=>four)(c) Array([1]=> 1)(d) Array([0]=>0 [5]=>5)I have been asked this question by my school teacher while I was bunking the class.This question is from Introduction to Preg in PHP in section Objects and Databases in PHP of PHP

Answer»

Right CHOICE is (b) Array([2]=>two [3]=>THREE [4]=>four)

To elaborate: When we include PREG_GREP_INVERT, this will invert our data, so instead of OUTPUTTING NUMBERS it will output our non-numeric VALUES.



Discussion

No Comment Found

Related InterviewSolutions