First, let’s take a look at the introduction to the use of the substring function.
1. substring
substring requires at least one parameter, the first parameter is the starting position, and the second optional parameter is the ending position.
Only one parameter:
2. substr
substr also requires at least one parameter. The first parameter is the starting position, and the second parameter is optional and is the length.
Only one parameter:
As can be seen from the above example, when substring and substr have only one parameter, the results are the same, and only the second parameter is different.