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_object_hash() Is Deprecated

spl_object_hash() returns a string uniquely identifying an object for the lifetime of that object. In PHP 8.6, calling spl_object_hash() emits a deprecation notice, in favor of spl_object_id(), which returns an integer identifier instead of a string and is cheaper to compute. The function still returns a value in PHP 8.6.

PHP code

<?php

$obj = new stdClass();
var_dump(spl_object_hash($obj));

?>

Before

string(32) "0000000038bff86f0000000058eaf75e" 

After

PHP Deprecated:  Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /codes/splObjectHashDeprecated.php on line 4

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /codes/splObjectHashDeprecated.php on line 4
string(32) "00000000000000010000000000000000" 

PHP version change

This behavior was deprecated in 8.6.

This behavior changed in .

See Also

Error Messages

Extension

© 2023-2026, Damien Seguy - Exakat