parse_numeric.php
<?php
 
$input = $argv[1];
 
$start = strpos($input, '11010'); /* Start Sentinel */
$to_parse = substr($input, $start); // strip leading zeros
$byte = '';
 
$pos = 0;
 
$parse_table = array(   '00001' => '0',
                        '10000' => '1',
                        '01000' => '2',
                        '11001' => '3',
                        '00100' => '4',
                        '10101' => '5',
                        '01101' => '6',
                        '11100' => '7',
                        '00010' => '8',
                        '10011' => '9',
                        '01011' => ':',
                        '11010' => ';',
                        '00111' => '<',
                        '10110' => '=',
                        '01110' => '>',
                        '11111' => '?');
 
 
while ($pos < strlen($to_parse)) {
    $byte = substr($to_parse, $pos, 5);
 
    echo $parse_table[$byte];
 
    if ($byte == '11111') { /* End Sentinel */
        break;
    }
    $pos += 5;
}
 
echo "\n";