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

spl_classes() Is Deprecated

spl_classes() returns an array naming the classes and interfaces provided by the SPL extension. In PHP 8.6, calling it emits a deprecation notice recommending ReflectionExtension::getClassNames() instead; the returned array is unchanged.

PHP code

<?php

$classes = spl_classes();
var_dump(count($classes));

?>

Before

int(55)

After

PHP Deprecated:  Function spl_classes() is deprecated since 8.6, use ReflectionExtension::getClassNames() instead in /codes/splClassesDeprecated86.php on line 3

Deprecated: Function spl_classes() is deprecated since 8.6, use ReflectionExtension::getClassNames() instead in /codes/splClassesDeprecated86.php on line 3
int(55)

PHP version change

This behavior was deprecated in 8.6.

This behavior changed in .

See Also

Error Messages

Extension

© 2023-2026, Damien Seguy - Exakat