Forum und email

hexdec

(PHP 4, PHP 5)

hexdec — Da esadecimale a decimale

Descrizione

int hexdec ( string $stringa_esadecimale )

Restituisce l'equivalente decimale di un numero esadecimale rappresentato dall'argomento stringa_esadecimale . hexdec() converte una stringa esadecimale in un numero decimale. Il più grande numero che può essere convertito è 7fffffff o 2147483647 espresso in decimale.

hexdec() ignora i caratteri non esadecimali che incontra.

Example#1 esempio di hexdec()

<?php
var_dump
(hexdec("See"));
var_dump(hexdec("ee"));
// entrambi stampano "int(238)"

var_dump(hexdec("that")); // stampa "int(10)"
var_dump(hexdec("a0"));   // stampa "int(160)"
?>

Vedere anche dechex(), bindec(), octdec() e base_convert().