note 48031 deleted from function.ascii2ebcdic by danbrown
| From: | danbrown@php.net | Date: | Mon, 25 Jan 2010 18:18:51 +0000 |
| Subject: | note 48031 deleted from function.ascii2ebcdic by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165285@lists.php.net to get a copy of this message | ||
Note Submitter: buzuk at free dot fr
----
If you need to convert IBM EBCDIC Comp or Comp-3 format (AS/400 Packed) you can use this function :
<?
/** Convert COMP or COMP-3 EBCDIC DATA
** @param binary $zComp Original EBCDIC Comp or Comp3 formated number
** @return int
**/
function comp2int( $zComp) {
$zTemp='';
for ($i=0; $i<4; $i++)
$zTemp.=sprintf("%08d", decbin(ord($zComp[$i])));
return bindec($zTemp);
}
?>
This function doesn't work with signed numbers.