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 equivalent 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 :
SplHead
, and all it can depend uponThis 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.