Esempio n. 1
0
File: benc.php Progetto: latik/xbt
function benc($obj)
{
    if (!is_array($obj) || !isset($obj['type']) || !isset($obj['value'])) {
        return;
    }
    $c = $obj['value'];
    switch ($obj['type']) {
        case 'dictionary':
            return benc_dict($c);
        case 'integer':
            return benc_int($c);
        case 'list':
            return benc_list($c);
        case 'string':
            return benc_str($c);
    }
}
Esempio n. 2
0
function benc($obj)
{
    if (!is_array($obj) || !isset($obj["type"]) || !isset($obj["value"])) {
        return;
    }
    $c = $obj["value"];
    switch ($obj["type"]) {
        case "string":
            return benc_str($c);
        case "integer":
            return benc_int($c);
        case "list":
            return benc_list($c);
        case "dictionary":
            return benc_dict($c);
        default:
            return;
    }
}