Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 547 Bytes

0027.md

File metadata and controls

25 lines (20 loc) · 547 Bytes

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