Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
を使用してみspl_object_hashましたが、明らかに関数オブジェクトでは機能しません。
spl_object_hash
では、これをどのように行うのが最善でしょうか?
関数オブジェクトは、他のオブジェクトと同じです。spl_object_hash彼らのためにも働くべきです。また、これが機能しないことに関するドキュメントの参照も見つかりません。
私は実際にそれを試してみましたが、うまくいくようです:
<?php class x { function __invoke() { return 'Test'; } } $x = new x; echo $x(); // Test echo spl_object_hash($x); // The hash