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 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.
$sentence = ['John', 'Doe', 'has', 'a', 'car'];
foreach ($sentence as $word) {
echo (function() use ($word) {
return $word;
}) () [0];
}
What will be your
role in the community?
Join the SkillValue Community!
Create your
free account
Assess your tech skills for free.
All fields are required.
Already have an account? Log In
Create your
free account
Get 8 tech competency assessments
for free
Hire top developers, faster
All fields are required.
Already have an account? Log In