(PHP Extension) StringBuilder GetEncoded
Demonstrates the Chilkat StringBuilder GetEncoded method.
<?php
// The version number (9_5_0) should match version of the Chilkat extension used, omitting the micro-version number.
// For example, if using Chilkat v9.5.0.48, then include as shown here:
include("chilkat_9_5_0.php");
$s = 'The quick brown fox jumps over the lazy dog';
$sb = new CkStringBuilder();
$sb->Append($s);
// output: The quick brown fox jumps over the lazy dog
print $sb->getAsString() . "\n";
// Get the string encoded to base64, without changing the contents of sb.
// output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
print $sb->getEncoded('base64','utf-8') . "\n";
// The contents of sb are not changed..
// output: The quick brown fox jumps over the lazy dog
print $sb->getAsString() . "\n";
?>
|