Question from the PHP8 test

How to use a final private method in PHP

Medium

What will it be displayed?

<?php

class Foo
{
    public function getFullName()
    {
        return $this->getName() .  ' surname';
    }
    
    final private function getName()
    {
        return 'name';
    }
}

$foo = new Foo();
echo $foo->getFullName();
Author: MathisStatus: Published(Update)Question passed 52 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!