我想下标字符串中的每个数字。
例如:
$str = '1Department of Chemistry, College of 2Education for Pure Science';
我想要的输出:
<sub>1</sub>Department of Chemistry, College of <sub>2<sub>Education for Pure Science
我从一个字符串中获取了所有数字:
//digits from string
preg_match_all('!\d+!', $str, $matches);
print_r($matches);
但是我怎样才能对数字应用下标效果并打印字符串呢?
最佳答案
关于php - 字符串中的下标数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32969564/