KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using PHP to convert Hexadecimal to Decimal
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac & Win
Published On: August 9, 2011

Here is a quick method that can be used for converting Hexadecimal values to Decimal values using PHP EXECUTE and the hexdec php command:

C_TEXT($1)
C_LONGINT($0)
C_BOOLEAN($phpOK)
If
(Count parameters=1)
 $phpOK:=PHP Execute("";"hexdec";$0;$1)
End if


If the above code is saved as a project method named UTIL_php_HexToDec it could be used to convert a Hexadecimal value to an Integer value like so:

C_LONGINT($int)
$int:=UTIL_php_HexToDec("FD10")


In the above example $int would be equal to "64784".