get_class() Needs An Argument¶
get_class() had a default behavior, where the current class would be returned when get_class() is called without argumnts. 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