如何在Php中更改新行的变量值

问题描述 投票:-2回答:1

这里我有一行变量值。你可以在下面的php源代码中看到

<?php

$list = "03343922581 03136011388 03142181356 03471819024 03003973577";

//Please tell me the php code

?>

我想得到如下的输出

03343922581  
03136011388   
03142181356   
03471819024   
03003973577
php list
1个回答
0
投票

根据您的愿望在html页面中显示结果,您可以使用:

$new_list = str_replace(" ","\n",$list);
echo nl2br($new_list);
© www.soinside.com 2019 - 2024. All rights reserved.