Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Zend 200-710 Exam - Topic 8 Question 9 Discussion

Posted by Golda on May 07, 2022 at 10:27 AM

How many elements does the $matches array contain after the following function call is performed?

preg_match('/^(\d{1,2}([a-z]+))(?:\s*)\S+ (?=201[0-9])/', '21st March 2014', $matches);

Suggested Answer: C

Get Premium 200-710 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
11 comments · newest first
LE
Leanora 1 year ago
Definitely 2, the regex captures two groups!
AL
Alesia 1 year ago
I’m not so sure about that, could be 1 too.
TI
Timmy 1 year ago
Wait, really? I thought it might be 3.
RY
Ryan 1 year ago
Totally agree, it's 2!
LI
Lizbeth 1 year ago
The $matches array will have 2 elements.
SH
Shenika 1 year ago
I recall that the first capturing group counts as one, and if there's a second one, that might make it 2. But what about the full match?
FR
Francine 1 year ago
I feel like it could be 3 because of the way the regex is structured, but I could be mixing it up with another example.
HI
Hillary 1 year ago
I'm not entirely sure, but I remember a similar question where the number of matches was based on the capturing groups.
TO
Tomoko 1 year ago
I think the regex captures two groups, so maybe the $matches array has 2 elements?
SE
Selma 1 year ago
I'm a bit confused by this question. I'm not sure which method would be the best approach.
YA
Yasuko 1 year ago
I'm pretty confident the JeOS toolkit has a command line utility, but I'm not sure about the other two. I'll have to guess on those and hope I get at least one right.
0/2000 characters

Save Cancel