$tag = eZTagsObject::fetch($tagID);
if (!($tag instanceof eZTagsObject || $TagID == 0)) {
    header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
} else {
    $children = eZTagsObject::fetchByParentID($tagID);
    $response = array();
    $response['error_code'] = 0;
    $response['id'] = $tagID;
    $response['parent_id'] = $tag instanceof eZTagsObject ? (int) $tag->attribute('parent_id') : -1;
    $response['children_count'] = count($children);
    $response['children'] = array();
    foreach ($children as $child) {
        $childResponse = array();
        $childResponse['id'] = (int) $child->attribute('id');
        $childResponse['parent_id'] = (int) $child->attribute('parent_id');
        $childResponse['has_children'] = eZTagsObject::childrenCountByParentID($child->attribute('id')) ? 1 : 0;
        $childResponse['synonyms_count'] = eZTagsObject::synonymsCount($child->attribute('id'));
        $childResponse['subtree_limitations_count'] = $child->getSubTreeLimitationsCount();
        $childResponse['keyword'] = $child->attribute('keyword');
        $childResponse['url'] = 'tags/id/' . $child->attribute('id');
        $childResponse['icon'] = lookupIcon($eztagsINI, $child);
        eZURI::transformURI($childResponse['url']);
        $childResponse['modified'] = (int) $child->attribute('modified');
        $response['children'][] = $childResponse;
    }
    $httpCharset = eZTextCodec::httpCharset();
    $jsonText = arrayToJSON($response);
    $codec = eZTextCodec::instance($httpCharset, 'unicode');
    $jsonTextArray = $codec->convertString($jsonText);
    $jsonText = '';
    foreach ($jsonTextArray as $character) {
<?php

echo 'ciao';
$numberOfChildren = 0;
$childrenArray = array();
$ezTagsObject = new eZTagsObject();
$numberOfChildren = eZTagsObject::childrenCountByParentID(20);
$childrenArray = eZTagsObject::fetchByParentID(20);
echo '----------Il numero dei figli del nodo Aromenti:<br>';
echo $numberOfChildren . '<br>';
echo '----------I figli del nodo Aromenti:<br>';
print_r($childrenArray);
echo '<br>----------Fine array----------------------';