且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP:插入文本直到定界符

更新时间:2023-02-20 08:46:32

看起来不错,尽管您可以保存temp变量:

Looks fine, although you can save the temp variables:

$newtext = explode(":", $line,1);
echo "<font color=red>$newtext[0]</font>:$newtext[1]";

这可能会更快,也可能不会,您必须进行测试:

This might be faster or might not, you'd have to test:

echo '<font color=red>' . substr_replace($line, '</font>', strpos($line, ':') , 0);