⭐ in reply to Why does $string++ work the way it does?
The alternative would be to convert it to a number (0) and increment that (1), which doesn't make a lot of sense if you start off with a string, so why not make something useful out of it?
Note that this is the way that ++ differs from + and +=. The latter two operations require another argument, which can't really be anything but a number, which would convert your string to numeric form first. So if you really do want to end up with a 1 and start from a string, just use +1 or +=1 to get it.
|
|---|