Typescript Count Elements In Array Php