National_Instruments
200-500 · Question #77
How many elements does the array $matches from the following code contain? 1 <?php 2 $str = "The cat sat on the roof of their house."; 4 $matches = preg_split("/(the)/i", $str, -1…
The correct answer is D. 7. See the full explanation below for the reasoning.
Question
How many elements does the array $matches from the following code contain? 1 <?php 2 $str = "The cat sat on the roof of their house."; 4 $matches = preg_split("/(the)/i", $str, -1, PREG_SPLIT_DELIM_CAPTURE); 5 ?>
Options
- A2
- B3
- C4
- D7
- E9
How the community answered
(21 responses)- A5% (1)
- C5% (1)
- D81% (17)
- E10% (2)
Community Discussion
No community discussion yet for this question.