Test description

This test will challenge your knowledge of the PHP environment, focusing on the new features of PHP 8.
Topics: named argument, union types, match expression, final class constants, 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.

Sample questions

1
What is the result of the following code?

$sentence = ['John', 'Doe', 'has', 'a', 'car'];
foreach ($sentence as $word) {
    echo (function() use ($word) {
        return $word;
    }) () [0];
}