note 74639 deleted from language.operators.increment by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 15:22:16 +0000 |
| Subject: | note 74639 deleted from language.operators.increment by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189854@lists.php.net to get a copy of this message | ||
Note Submitter: Q1712 at online dot ms
----
A more detailed explanation of the string incremant is:
First of all it is checked wether the string is a standart representaion of a number wich is true if
it equals the regex /^ *[+-]?[0-9]*(\.[0-9]|[0-9]\.)[0-9]*([eE]?[+-]?[0-9]+)?$/
but not the regex /\+\./ (no idea why).
if it does, the type is changed to integer (if it equals /^ *[+-]?[0-9]+$/) or to float and then
incremented by one.
An empty string becomes the string "1".
Otherwise if the last character is one of [0-8], [a-y] or [A-Y] it is incremented. If it is Z it
puts it back to A, is z to a, if 9 to 0 and trys to do the same with the previouse character.
If a character is reatched that is not in [0-9a-zA-Z], nothing is done anymore (that's why
" Z" will increment to " A").
If the begining is reached a new caracter is prepended. "1" "a" or "A"
depending on wether the first character was "9", "z" or "Z".
If the last character was not [0-9a-zA-Z] the string isn't chaged.
hope this helps someone