How to find the longest side of the box in php?