Sort arrays by parent_id with PHP