/ LJCPHPCodeDoc / LJCTextLib / LJCStringBuilder / AppendTags


Parameters
$tag - The tag value.
$text - The text value.
$indent - The number of tabs to add to the line beginning.
$addBreak - Adds an HTML break before the cr/lf.

Syntax

PHP
public function AppendTags(string $tag, ?string $text, int $indent
, bool $addBreak = false)

Appends a text line with begin tag, end tag and indents.

Example

PHP
 $webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon";
 require_once "$webCommonPath/LJCTextLib.php";
 
 $builder = new StringBuilder();
 $builder->AppendTags("First", "FirstValue", 0, true);
 $builder->AppendTags("Second", "SecondValue", 1, true);
 
 // $text =
 // <First>FirstValue</First><br />
 //   <Second>SecondValue</Second><br />
 $text = $builder->ToString();

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.