Adapt three versions php