Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

get_class() Needs An Argument

get_class() had a default behavior, where the current class would be returned when get_class() is called without arguments. This is now deprecated.

It is also deprecated for get_parent_class().

PHP code

<?php

class x {
        function foo() {
                echo get_class();
                echo get_parent_class();
        }
}

(new x)->foo();

?>

Before

x

After

Calling get_class() without arguments is deprecated

PHP version change

This behavior was deprecated in 8.3.

This behavior changed in 9.0.

Error Messages

Analyzer

© 2023-2026, Damien Seguy - Exakat