* Update strpos.xml with error handling details
Added error handling information for offset parameter, after observing this un/underdocumented fatal in production.
Note: Using the github web editor, I am not sure if I can pull a second file into this PR, so I may submit a second PR to handle `stripos`.
* Document error for offset exceeding haystack length
Added error handling information for offset parameter.
* Document error for exceeding offset length
Added error handling information for offset parameter.
* Document error for offset exceeding haystack length
Added error handling information for offset parameter.
* Apply suggestions from code review
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
* Apply review suggestions
* Remove csprng-specific html entity
* Add invalid offset ValueError information to strrpos-related methods
* Fix whitespace for strprpos error message info
---------
Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
The function first determines the starting position of the substring (part of the original string), and then drops abs($length) characters from the tail of this substring if the value of the $length parameter is negative. I don't understand the meaning of the parenthesized notation, and it seems redundant to me; as if the $length parameter behaves differently with a positive offset. My point is that with a negative value of the $offset parameter, the behavior of the $length parameter does not change, so why mention the negative offset separately. Moreover, the end of the original string and the end of the substring that remained after applying the offset are the same ends, no matter how you look at it, and it is from these ends that the function will discard characters.
* strcmp: Improve behavior description and direct users to alternative functions (strcoll and Collator::compare) where appropriate;
Add the "similarity" functions to seealso
Removed substr from seealso (why is it here?)
* Cross-link all the string similarity functions
* Trailing whitespace removal
* Update reference/strings/functions/strcmp.xml
Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
* strcmp: Improve behavior description and direct users to alternative functions (strcoll and Collator::compare) where appropriate
---------
Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
Most of the text still acted as though "create a bunch of local variables" was the normal behaviour, even though it's been discouraged for years, and isn't even supported in PHP 8.
There were also a few incorrect or questionable uses of markup.
* Add PHP 8.4 changelog entry for strcspn()
* Update reference/strings/functions/strcspn.xml
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
---------
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>