According to the substr()
manual
If string is less than offset characters long, an empty string will be returned.
But with negative offset
substr("abc",-9,1)
the function returns
a
Mathematically speaking, a negative is always less than any string length of course, so there's no conflict with the above, but why doesn't it return an empty string though, in this direction, too? Is there a workaround without checking the length first?
https://onlinephp.io?s=s7EvyCjg5UpNzshXKC5NKi4p0lBKTEpW0tG11DHUVLAGAA%2C%2C&v=8.2.1