converting text to binary code
| From: | Scott Mebberson | Date: | Fri, 08 Sep 2000 04:41:19 +0000 |
| Subject: | converting text to binary code | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-15826@lists.php.net to get a copy of this message | ||
I have a text field(name=convertStr) in which you enter some text then click
the submit button.
If thens parses the variable $convertStr to the new script below:
<?php
$curVersion = ".001";
$binStr = pack ("A", "$convertStr");
$normStr = unpack ("A", $binStr);
echo ("normal string = $convertStr<br>\n");
echo ("binary string = $binStr<br>\n");
echo ("unpacked binary = "normStr[A]<br>\n");
?>
All I want it to do is take $convertStr convert it to binary code and set
the value to $binStr, the decode $binStr back in to text format as $normStr.
I don't know what method to use. It isn't explained very well at all on
php.net manaual.
can anybody help me??
thanks
Scott.