我的代码中有以下行,它以6个字符显示我的输出,前导零.
$formatted_value = sprintf("%06d", $phpPartHrsMls);
Run Code Online (Sandbox Code Playgroud)
我想用空格替换前导零.尝试过通过搜索本网站和其他网站找到的所有示例,但无法弄明白.
这是我尝试过的一些.
$formatted_value = sprintf("%6s", $phpPartHrsMls);
$formatted_value = printf("[%6s]\n", $phpPartHrsMls); // right-justification with spaces
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!!