The whole algorithm of this is just reading numbers and after that write "dl---dc---dc---dr" for example if the first number is 4. Not everyone will download or run this on their hardware (maybe theyre using only mobile phones) thats why im asking about php script .
Ps. If you can add to this new feature that can say if the formation is legal or not that would be great

I can help. For this you need to check if the score of last 3 numbers < 4 then write "formation is illegal"(because formations like this are not legal 4-3-0-2-1), if there is no 4 number detected or 2w or 3w (for example 3-3-0-1-3) then writte "formation is illegal"(because you need atleast 2 players on the flanks) and the last one if in entered numbers are found 3 times things 4, 2w and 3w then write "formation is illegal"(because you can't play with 3 players on the flanks).