Best Fit Memory Allocation in PHP