php script fixed

fixed from that broken for loop before