0
我试图做一些seuqential计数,通过一个文本文件充满preg_replace在PHP中的行...虽然下面的代码适用于我...它的计数反向...任何人都知道如何我可以从1开始而不是倒数到1?使用preg_replace连续计数
$num = count($lines);
$return = preg_replace('%\$postnum%msi','post' . $num, $return);
它返回:
post10
post9
post8
post7
post6
post5
post4
post3
post2
post1
我希望它返回此:
post1
post2
post3
post4
post5
post6
post7
post8
post9
post10
任何建议?谢谢。