note 51375 added to function.hexdec

From: Date: Tue, 29 Mar 2005 07:59:21 +0000
Subject: note 51375 added to function.hexdec
Groups: php.notes 
Request: Send a blank email to php-notes+get-87127@lists.php.net to get a copy of this message
To convert a cellular ESN from hexadecimal to decimal, use the following code. The base conversion is different due to the fact that the first two characters of a hexadecimal value must be converted seperately from the remaining six characters. <? function esnhexdec($hex){ $a = sprintf("%03d", hexdec(substr($hex, 0, 2))); $b = sprintf("%08d", hexdec(substr($hex, 2, 6))); return $a . $b; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.hexdec.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51375 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51375&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51375&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51375&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51375&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51375&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51375&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#87127) next »