Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dechex(3) [php man page]

DECHEX(3)								 1								 DECHEX(3)

dechex - Decimal to hexadecimal

SYNOPSIS
string dechex (int $number) DESCRIPTION
Returns a string containing a hexadecimal representation of the given unsigned $number argument. The largest number that can be converted is PHP_INT_MAX * 2 + 1 (or -1): on 32-bit platforms, this will be 4294967295 in decimal, which results in dechex(3) returning ffffffff. PARAMETERS
o $number - The decimal value to convert. As PHP's integer type is signed, but dechex(3) deals with unsigned integers, negative integers will be treated as though they were unsigned. RETURN VALUES
Hexadecimal string representation of $number. EXAMPLES
Example #1 dechex(3) example <?php echo dechex(10) . " "; echo dechex(47); ?> The above example will output: a 2f Example #2 dechex(3) example with large integers <?php // The output below assumes a 32-bit platform. // Note that the output is the same for all values. echo dechex(-1)." "; echo dechex(PHP_INT_MAX * 2 + 1)." "; echo dechex(pow(2, 32) - 1)." "; ?> The above example will output: ffffffff ffffffff ffffffff SEE ALSO
hexdec(3), decbin(3), decoct(3), base_convert(3). PHP Documentation Group DECHEX(3)

Check Out this Related Man Page

HEXDEC(3)								 1								 HEXDEC(3)

hexdec - Hexadecimal to decimal

SYNOPSIS
number hexdec (string $hex_string) DESCRIPTION
Returns the decimal equivalent of the hexadecimal number represented by the $hex_string argument. hexdec(3) converts a hexadecimal string to a decimal number. hexdec(3) will ignore any non-hexadecimal characters it encounters. PARAMETERS
o $hex_string - The hexadecimal string to convert RETURN VALUES
The decimal representation of $hex_string EXAMPLES
Example #1 hexdec(3) example <?php var_dump(hexdec("See")); var_dump(hexdec("ee")); // both print "int(238)" var_dump(hexdec("that")); // print "int(10)" var_dump(hexdec("a0")); // print "int(160)" ?> NOTES
Note The function can convert numbers that are too large to fit into the platforms integer type, larger values are returned as float in that case. SEE ALSO
dechex(3), bindec(3), octdec(3), base_convert(3). PHP Documentation Group HEXDEC(3)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

mathematics operations in unix

Hello guys! Can say me anybody about operatios with unix, I don't to make operations, only inside in a variable, like this #y=4 #x=2 #let z=$y-$x #echo $z # 2 but I can't to make mathematical operations with decimal like this #y=3.2 #x=1.5 #let z=$y-$x #echo $z # 3 this... (2 Replies)
Discussion started by: cesar720213
2 Replies

2. Shell Programming and Scripting

Decimal to Hexadecimal conversion

Hi frnds :) I need a small help... I have a very long file containing 20 digits decimal number which i want to convert into the corresponding 16 digit hexadecimal values. File looks like.... 11908486672755551741 05446378739602232559 04862605079740156652 . . . I tried the script for i... (7 Replies)
Discussion started by: vanand420
7 Replies

3. UNIX for Dummies Questions & Answers

What is the output of echo *

Hi all, Kindly let me know the output of echo * command. (4 Replies)
Discussion started by: shailja
4 Replies

4. Shell Programming and Scripting

Converting a decimal into integer

Hi all, I'm trying to convert a decimal number into an integer number; I'm doing this: n=`echo |awk '{ print "'"$mem"'"*10}'` where the variable mem is equal to 3.7 I'd like to obtain 37, but the expression above gives me 30. Help please!!!! thx a lot (4 Replies)
Discussion started by: idro
4 Replies

5. Shell Programming and Scripting

Evaluating Decimal values

How can I evaluate a decimal value in an if statement? echo "Enter limit:" read limit (enter a decmal value, ie: 2.5) decimallimit=`echo $limit+0|bc|quit` echo $decimallimit if then echo $decimallimit else echo "failed" fi (4 Replies)
Discussion started by: larrys721
4 Replies

6. UNIX for Dummies Questions & Answers

Simple 'echo' question

Hi, I would like to output the identical line to 2 text files, ie output='blah' echo $output > test1.txt echo $output > test2.txt Is there a way I could do that output with ONE command, ie output='blah' echo $output > test1.txt & test2.txt (I know that doesn't work) Thanks for any... (1 Reply)
Discussion started by: msb65
1 Replies

7. UNIX for Dummies Questions & Answers

Hexadecimal to Decimal

Hi all, I have a small script to convert my HexaDecimal Input to Decimal as output. #!/bin/ksh hd=00208060 dec=`printf %d $hd` echo $dec Output of the above program: printf: 00208060 not completely converted 16 But my expected output is "2130016". How can i acheive this. I... (2 Replies)
Discussion started by: Arunprasad
2 Replies

8. Shell Programming and Scripting

awk command to separate a field

I have a log file that I am trying to convert. File contents something like this: aaaaa bbbbbb cccc dddddd\123 eeeee ffffffff I am trying to output the fields in a different order and separate field 4 so that the "123" and "dddddd" can be output separately. for example bbbbbb aaaaa 123... (5 Replies)
Discussion started by: jake1988
5 Replies

9. UNIX for Dummies Questions & Answers

echo is returning empty

OS - AIX 6.1 I am have below entry in my .profile DS_LIB=/opt/IBM/InformationServer/Server/DSEngine/bin export DS_BIN When I do echo $DS_BIN, echo is returning empty $ echo $DS_BIN $ I never had this kind of issue earlier, please help me. Thanks srimitta (4 Replies)
Discussion started by: srimitta
4 Replies

10. HP-UX

Division returning a negative number

Hi All, Just faced an interesting thing in HP-UX. I was dividing 2955334616 / 2 by using echo `expr 2955334616 / 2` , and this ofcourse which expects 1477667308 to be returned. But I am getting -669816340 and I am :wall: how exactly this is possible. It is not one of the compliments (Ones or... (4 Replies)
Discussion started by: mail2sanand
4 Replies

11. Shell Programming and Scripting

To convert file with decimal to another file with Hexadecimal

I have a text file of alphanumeric values listed one by one. I have to convert them to hexadecimal equivalents for each character seperated by ":" in Unix bash shell script. For example, 12345678 has to be converted to 31:32:33:34:35:36:37:38 (10 Replies)
Discussion started by: mathie
10 Replies

12. Shell Programming and Scripting

error- multiplying negative decimal values

a=10.02 pattern=-11.01 b=$(echo | awk '{ print $a*$pattern}') echo $b its not working even ALso tried `expr $a \* $pattern` No LUCK (3 Replies)
Discussion started by: saluja.deepak
3 Replies

13. UNIX for Dummies Questions & Answers

What will echo $$ command give

Hi I tried giving the following command echo $$a I got an output like 32178a Can some one please explain why echo $$ is returning 32178 Thanks in advance (6 Replies)
Discussion started by: Sri3001
6 Replies

14. Shell Programming and Scripting

Converting string to negative decimal value

I need code for converting a string to a negative decimal value. For ex, i have the value in the form of a string (5489.95-) i need to convert it into decimal value (-5489.95) while getting output using printf command. i know how to get as a string a="5489.95-" printf "%10s"$a >>xyz.dat ... (5 Replies)
Discussion started by: angie1234
5 Replies

15. Programming

Splitting string and storing in int

I have a string containing 2 integers separated by /, for example 12/8 or 8/6 am want to store the numbers in two integers. (3 Replies)
Discussion started by: kristinu
3 Replies