jmknash
01-16-2012, 09:29 PM
Hello,
I would like a script to read a text file containing a single ASCII character and print it out on a webpage as it's Decimal value. I cannot find such script anywhere and know few of PHP coding to modify the below code.
Below is a script I found which prints as Hexadecimal.
<?php
$handle = @fopen("DATA.TXT", "r");
if ($handle) {
while (!feof($handle)) {
$hex = bin2hex(fread ($handle , 4 ));
print $hex."\n";
}
fclose($handle);
}
?>
` DATA.txt contains:
t
Any help appreciated. Thanks, Jon.
I would like a script to read a text file containing a single ASCII character and print it out on a webpage as it's Decimal value. I cannot find such script anywhere and know few of PHP coding to modify the below code.
Below is a script I found which prints as Hexadecimal.
<?php
$handle = @fopen("DATA.TXT", "r");
if ($handle) {
while (!feof($handle)) {
$hex = bin2hex(fread ($handle , 4 ));
print $hex."\n";
}
fclose($handle);
}
?>
` DATA.txt contains:
t
Any help appreciated. Thanks, Jon.