note 129812 added to function.str-increment

From: Date: Mon, 21 Oct 2024 05:39:26 +0000
Subject: note 129812 added to function.str-increment
Groups: php.notes 
Request: Send a blank email to php-notes+get-221603@lists.php.net to get a copy of this message
The strings are incremented per character and each character position can be one of 3 modes: 1. [A-Z] uppercase 2. [a-z] lowercase 3. [0-9] decimal you can mix any combination of the modes and (at least in right to left languages like english) it always increments from the right overflowing leftwards the mode/type of character that overflows remains the mode/type of the first (0 index) position. so: input 'zZ9' & 'aaA0' is returned so: input 'Z9z' & 'AA0a' is returned so: input '9zZ' & '10aA' is returned Example: <?php $str = 'zZ9'; // overflows in lowercase echo $str = str_increment($str).PHP_EOL; // aaA0 $str = 'Z9z'; // overflows in uppercase echo $str = str_increment($str).PHP_EOL; // AA0a $str = '9zZ'; // overflows in decimal echo ($str = str_increment($str)); // 10aA ?> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 1.123.19.45) ---- Manual Page -- https://php.net/manual/en/function.str-increment.php Edit -- https://main.php.net/note/edit/129812 Del: integrated -- https://main.php.net/note/delete/129812/integrated Del: useless -- https://main.php.net/note/delete/129812/useless Del: bad code -- https://main.php.net/note/delete/129812/bad+code Del: spam -- https://main.php.net/note/delete/129812/spam Del: non-english -- https://main.php.net/note/delete/129812/non-english Del: in docs -- https://main.php.net/note/delete/129812/in+docs Del: other reasons-- https://main.php.net/note/delete/129812 Reject -- https://main.php.net/note/reject/129812 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221603) next »