<<< Previous question <<< Question ID#0027.md >>> Next question >>>
What is the result of the following code?
$sentence = ['John', 'Doe', 'has', 'a', 'car'];
for ($i = 0; $i < count($sentence); $i++) {
echo (function() use ($sentence) {
return $sentence;
})()[$i][0];
}
- A) JDhac
- B) JohnD
- C) A parse error
- D) 5 warnings saying than function needs to have name to be used
Answer
Answer: A