Typescript Type Last Element Of Array Php Use For Loop