So I want to create a text to binary. But before I convert straight to binary, I have to make it ASCII...not a hard concept. I just need a boost on an optimized way on doing this. Would the only way be if I made a library script of my own where the variables were already defined...such as:

(char to ascii): a=97
(ascii to binary): 97=1100001

or would an easier way be if I already had the ascii converted to binary (figure it out myself).

Basiclly: I need a way to take user input from a form, then read each character and give an output of the binary.

    Its actually easier than you think. There are functions that can do this for you. Just combine the ord and decbin functions. e.g.

    <?

    $strin="123ABC";

    for ( $loop=0; $loop<strlen($strin); $loop++ )
    {
    echo "(".decbin(ord($strin[$loop])).")<P>";
    }

    ?>

    Any string fed in is returned as the binary equivalent.

    Mark.

      Write a Reply...