【发布时间】:2016-03-02 11:00:57
【问题描述】:
如何查找字符串中是否存在 2 个或 3 个数字的组合,然后将其拆分为两个变量?
例如:$input = "this and that 12" 或 $input = "this and that 100"
我想把这个字符串分成两个变量:
$text = "this and that",
$number = "12"(或上例中的“100”)
P.S 字符串是用户输入的,也可以不包含任何数字,例如$input = "this and that";
【问题讨论】:
-
数字总是在字符串的末尾吗?只有一个数字?
-
yes 总是在最后,可以是 2 位或 3 位数字
标签: php string variables split explode