Typescript Index Last Element In Array Php