PHP Extension
PHP Extension
Example: JsonObject.NewArrayOf method
See more JSON Examples
Demonstrates theNewArrayOf method.
Chilkat PHP Extension Downloads
<?php
include("chilkat.php");
$success = false;
$big_cats = '[\'lion\',\'tiger\',\'leopard\',\'jaguar\',\'cheetah\',\'snow leopard\',\'clouded leopard\',\'cougar\',\'puma\',\'panther\']';
$json = new CkJsonObject();
$json->UpdateString('test','abc');
$success = $json->NewArrayOf('big_cats',$big_cats);
if ($success == false) {
print $json->lastErrorText() . "\n";
exit;
}
$json->put_EmitCompact(false);
print $json->emit() . "\n";
// Result:
// {
// "test": "abc",
// "big_cats": [
// "lion",
// "tiger",
// "leopard",
// "jaguar",
// "cheetah",
// "snow leopard",
// "clouded leopard",
// "cougar",
// "puma",
// "panther"
// ]
// }
?>