donglin1692 2014-02-12 11:05
浏览 14
已采纳

如何在php中关闭连接'ENTER'值[关闭]

I need a method that concatenate string with enter. As an example my string "Apple", "Box".

That string needs to be as:

$mynewstring = "Apple
                Box"

Not as:

$mynewstring ="Apple "." "."Box" or $mynewstring ="Apple "."<br>"."Box"

Please tell how to do this.

  • 写回答

2条回答 默认 最新

  • drkj41932 2014-02-12 11:13
    关注

    Just do like this..

    <?php
    $mynewstring = "Apple,Box";
    $arr=explode(",",$mynewstring);
    echo(implode(PHP_EOL,$arr)); 
    

    OUTPUT :

    Apple
    Box
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?