Home > Backend Development > PHP Tutorial > 请老师指导一上。怎么把这个输出变成字符串

请老师指导一上。怎么把这个输出变成字符串

WBOY
Release: 2016-06-13 11:11:27
Original
847 people have browsed it

请老师指导一下。如何把这个输出变成字符串。

本帖最后由 hsx49949046 于 2012-12-27 13:25:32 编辑 for($i=$sxa;$i$i=sprintf("%03d", $i);
$text = $i.",";
echo $text;
}
$text 在浏器里输出为:001,002,003,004,005

我现在是想把这个输出结果001,002,003,004,005保存在一个变量。在循环以外使用。请问该怎么做?
如果把它放在循环以外输出,echo $text; 只能显示005 这个数。

------解决方案--------------------
$text='';
for($i=$sxa;$i$i=sprintf("%03d", $i);
$text .= $i.",";
//echo $text;
}
echo $text;
------解决方案--------------------
本帖最后由 xuzuning 于 2012-12-27 13:28:32 编辑 $text .= $i.",";
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template