If you want to put consecutive numbers together, you can directly use array_reduce to calculate the results and then use implode to splice them into a string.
But I don’t understand your pattern. In your first example, 1 and 2 are not connected, but in your second example, 102 and 103 are connected. Is it a mistake or do you have special needs?
If you want to put consecutive numbers together, you can directly use array_reduce to calculate the results and then use implode to splice them into a string.
But I don’t understand your pattern. In your first example, 1 and 2 are not connected, but in your second example, 102 and 103 are connected. Is it a mistake or do you have special needs?