I had a test interview for a front-end position and the company even wanted to know my php level.
I am not so good at php so this is why I put the question here. In a question I had a class named ClassOne
, with the a protected method show()
. This class was extended by ClassTwo
. ClassTwo
was instantiated and the show method was invoked on it.
In the top of the script I called error_reporting(0)
.
error_reporting(0);
class ClassOne {
protected function show(){}
}
class ClassTwo extends ClassOne{
}
$obj2 = new ClassTwo();
$obj2->show();
I had to say what the code will display and I said "nothing, because show is protected and error_reporting(0) will not let any error to display." Is this right?
Someone told me that this will yield a fatal error and will be displayed even with error_reporting(0). The test was on paper so I don't know the right answer.
</div>