<?php header('Content-type: text/plain'); include_once('bencoding.php'); try { $bencode = new bencoding(); $x = $bencode->encode(array('test' => array(1, 'foo', 'bar', 3))); echo $x . "\n"; $x = $bencode->decode($x); print_r($x); } catch(Exception $e) { echo 'something goes wrong'; }