Silly little implementation of pairs in php, suboptimal