kphp
kphp copied to clipboard
substr function, remove return false
substr — Return part of a string
substr(string $string, int $offset, ?int $length = null): string
Before PHP 8.0 if substr is empty, returns false
substr("abcdef", 4, -4); // returns ""; prior to PHP 8.0.0, false was returned
In KPHP, because of this, you have to write additional conditions for translating false into an empty string. If this is fixed, the code becomes more readable and the behavior is more predictable.