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)
Answer: Option B
Solution(By Examveda Team)
When we include PREG_GREP_INVERT, this will invert our data, so instead of outputting numbers it will output our non-numeric values.Related Questions on Regular Expressions
A. 1 and 2
B. 2 and 4
C. 1 and 4
D. 2 and 3
Join The Discussion