Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用 php 自动增加字母数字,所以它看起来像:
AB001 AB002 ... ... BA001 ... ... ZZ001
然后需要将此代码添加到mysql,我在想一个varchar(5)。
干杯,
试试看
$x = 'AA998'; for($i = 0; $i < 10; $i++) { echo $x++,'<br />'; }
编辑
字母和数字的反转
$x = '000AY'; for($i = 0; $i < 10; $i++) { echo $x++,'<br />'; }
ZZ999后或反转
$x = 'ZZ998'; for($i = 0; $i < 10; $i++) { $x++; if (strlen($x) > 5) $x = '000AA'; echo $x,'<br />'; }