<?php
$fruits = "lemon
orange
banana
apple
pear";
$fruits_a = explode("\n", $fruits);
for ($i = 0; $i < count($fruits_a); $i++)
{
$fruits_a[$i] = trim($fruits_a[$i]);
}
$fruits = implode(" ", $fruits_a);
echo $fruits;
?>
是否可以将其(从爆炸到内爆)转换为单行?在python中它只是fruits = " ".join(x.strip() for x in fruits.split("\n"))