PHP - hexdec
Trieda
Metóda - hexdec
(PHP 4, PHP 5, PHP 7)
This hecdec() function converts a hexadecimal number to a
decimal number. The base_convert function which is universal
can be used instead.
Procedurálne
- function hexdec (string $hex_string) : number
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $hex_string | string | The hexadecimal number (represented as a string) to convert. |
Mávratovej hodnoty
Vracia: number
The converted number as a numerical type (number).
Príklady
<?php
$array = array("f8", "-b", "itnetwork", "e", "148", 11);
foreach ($array as $value)
echo ("'$value' (hex) => dec: '" . hexdec($value) . "'<br>");
This example outputs (if viewed from a web browser):
'f8' (hex) => dec: '248' '-b' (hex) => dec: '11' 'itnetwork' (hex) => dec: '14' 'e' (hex) => dec: '14' '148' (hex) => dec: '328' '11' (hex) => dec: '17'
Súvisiace manuály
- function base_convert (string $number, int $frombase, int $tobase) : string
- function bindec (string $binary_string) : number
- function dechex (int $number) : string
- function octdec (string $octal_string) : number
