I was reading the PHP manual for substr(), in which it states the following about the input string parameter:
string
The input string. Must be one character or longer.
But further down the page in the examples section, this was one of the examples:
// ...
echo "6) ".var_export(substr("", 0, 1), true).PHP_EOL;
// ...
This obviously contradicts the specification for the input string which was required to be one character or longer. The page stated the output of the above would be 6) ''.
Coming from a C/C++ background I'm very careful of UB, so I would like to know if passing a NULL or "" to substr() is legal?