Question from the PHP8 test

How to use a final private method in PHP

Archived

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: W3D TeamStatus: Archived(New question!)Question passed 201 times
1
Community EvaluationsNo one has reviewed this question yet, be the first!