开发者

using splheap in php 5.2

开发者 https://www.devze.com 2023-02-23 12:13 出处:网络
Is there any way to use splheap in php 5.2? Ie. could I paste the classes somewhere? Specifically I want to use it to sort items in an iterator, I\'m looking for the equiv开发者_Python百科alent of uso

Is there any way to use splheap in php 5.2? Ie. could I paste the classes somewhere? Specifically I want to use it to sort items in an iterator, I'm looking for the equiv开发者_Python百科alent of usort() on an iterator.


SplHeap (as other classes provided by PHP itself) is not coded in PHP.

It is actually coded in C -- as the rest of PHP itself -- and, as such, cannot just be copy-pasted to your project.


The only way you'd have of getting those classes into PHP 5.2 would be to :

  • Get the sources of PHP 5.3
  • Get the sources of PHP 5.2
  • Do some kind of merge between those -- merging the definitions of SplHead, and all it can depend upon
  • And compile your own version PHP 5.2 + those merges

This doesn't seem like quite an easy task ; and I would not recommend doing it : your PHP code would only be able to work with your own version of "PHP 5.2+merges".


Instead, considering that PHP 5.2 has reached his end of life, it would be much wiser to upgrade to PHP 5.3.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号