i want to add string data to before first character and after last character
Shortly i have string variable similar to this:(ever开发者_如何学运维y li elements is array element.)
<li>first</li>
<li>second</li>
.
.
.
I want get:
<ul>
<li>first</li>
<li>second</li>
.
.
.
</ul>
But require add string data's start and end for this avaible..
$var = "<ul>\n".$oldvar."\n</ul>";
will probably does it
Not really?
$my_string = "foo";
$new_string = "<start>" . $my_string . "<end>";
// $new_string is now "<start>foo<end>"
// or, another option:
$new_string = "<start>$my_string<end>";
This one's easy.
$str = "<li>.....</li>\n"
$strWithUL = "<ul>\n$str</ul>";
Hidden in plain sight :)
精彩评论