Recherche sur les Noms des fonctions php/mysql
hexdec()
Définition
Convertit de hexadécimal en décimal - (PHP 4, PHP 5)Description
Retourne une chaîne contenant la représentation décimale du nombre hex_string .
hexdec() ignorera tout caractère non-hexadécimal qu'elle rencontrera.
Liste de paramètres
- hex_string
-
La chaîne hexadécimale à convertir
Valeurs de retour
La représentation décimale de hex_string
Historique
| Version | Description |
|---|---|
| Depuis la version 4.1.0 | Cette fonction peut également convertir de très grands nombres. Elle retourne un nombre de type float dans ce cas. |
Exemples
Exemple #1 Exemple avec hexdec()
<?php
var_dump(hexdec("See"));
var_dump(hexdec("ee"));
// both print "int(238)"
var_dump(hexdec("that")); // affiche "int(10)"
var_dump(hexdec("a0")); // affiche "int(160)"
?>
Bouts de code utilisant la fonction hexdec()
<?php /* ... */
$image = imagecreatetruecolor($x_c, $y_c);
$color = imagecolorallocate($image, hexdec($color[0].$color[1]), hexdec($color[2
].$color[3]), hexdec($color[4].$color[5]));
/* ... */ ?>
<?php /* ... */
$bleu = substr($couleur_hex, 4, 2);
$tab_rgb = array('Rouge' => hexdec($rouge), 'Vert' => hexdec($vert), 'Bleu' => hexdec($bleu));
return $tab_rgb;
/* ... */ ?>
<?php /* ... */
{
$r = dechex(255 - hexdec(substr($couleur,0,2)));
$r = (strlen($r) > 1) ? $r : '0'.$r;
/* ... */ ?>
<?php /* ... */
$nbr_hexadecimal = '100';
echo hexdec($nbr_hexadecimal);
// affiche: 256
/* ... */ ?>
<?php /* ... */
function zeroFill($a, $b){
$z = hexdec(80000000);
if ($z & $a){
/* ... */ ?>
Connexion
Les fonctions
Références
- abs
- acos
- acosh
- asin
- asinh
- atan2
- atan
- atanh
- base_convert
- bindec
- ceil
- cos
- cosh
- decbin
- dechex
- decoct
- deg2rad
- exp
- expm1
- floor
- fmod
- getrandmax
- hexdec
- hypot
- is_finite
- is_infinite
- is_nan
- lcg_value
- log10
- log1p
- log
- max
- min
- mt_getrandmax
- mt_rand
- mt_srand
- octdec
- pi
- pow
- rad2deg
- rand
- round
- sin
- sinh
- sqrt
- srand
- tan
- tanh





