Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Christoph Kappestein  >  bencoding  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example script
Class: bencoding
Serialize and unserialize values in bencode format
Author: By
Last change:
Date: 5 years ago
Size: 324 bytes
 

Contents

Class file image Download
<?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';
}