考虑以下代码
<?php
// The new line separated string
$section_string = <<<EOL
Sentence A1. Sentence A2. Sentence A3.
Sentence B1. Sentence B2. Sentence B3.
Sentence C1. Sentence C2. Sentence C3.
EOL;
// Is there a function you can call like so:
$html_markup = unknown_awesome_function( $section_string );
echo $html_markup;
?>
预期产量<p>Sentence A1. Sentence A2. Sentence A3.</p><p>Sentence B1. Sentence B2. Sentence B3.</p><p>Sentence C1. Sentence C2. Sentence C3.</p>
而不是虚构的例子unknown_awesome_function()
, 是否有内置函数可以调用以生成多个<p>
基于带有新行分隔符的字符串的标记?