Login   Register  
PHP Classes
elePHPant
Icontem

File: demo.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Roberto Bertó  >  Hex2Bin - converts a hex string to a bin string  >  demo.php  >  Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: A simple sample
Class: Hex2Bin - converts a hex string to a bin string
Convert Hex Numbers to Binary Strings
Author: By
Last change: - ported to class
- three samples
Date: 12 years ago
Size: 441 bytes
 

Contents

Class file image Download
<?PHP

require ("class.hex2bin.php");

$hex2bin = new hex2bin();

function 
hex($hex)
{
        
$bin $GLOBALS["hex2bin"]->convert($hex);
        if (
$bin === FALSE)
        {
                
printf("%s isn't a hex string\n",$hex);
        } else {
                
printf("the hex string %s is the bin string %s\n",$hex,$bin);
        }
}


// true
hex("aabb33");

// false
hex("aac");

// false
hex("AJJJ22");

?>