1What is the result of the following code?
$sentence = ['John', 'Doe', 'has', 'a', 'car'];
foreach ($sentence as $word) {
echo (function() use ($word) {
return $word;
}) () [0];
}
This test will challenge your knowledge of the PHP 7 environment, focusing on new features of PHP 7. Topics: uniform-variable-syntax, the new null-coalesce and spaceship-comparison operators, scalar and return-types, iterable and nullable types, catching multiple exception, internal array pointers, grouping of namespaces, generators, etc.
$sentence = ['John', 'Doe', 'has', 'a', 'car'];
foreach ($sentence as $word) {
echo (function() use ($word) {
return $word;
}) () [0];
}