Question from the PHP8 test

Display the name of the user associated with an article in PHP

Medium

What will be displayed?

<?php

class User
{
    public string $name = 'Doe';
}

class Article
{
    public ?User $user = null;
   
}

$article = new Article;

echo $article?->user?->name;
Author: W3D TeamStatus: PublishedQuestion passed 879 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!