Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

base_convert(3) [php man page]

BASE_CONVERT(3) 							 1							   BASE_CONVERT(3)

base_convert - Convert a number between arbitrary bases

SYNOPSIS
string base_convert (string $number, int $frombase, int $tobase) DESCRIPTION
Returns a string containing $number represented in base $tobase. The base in which $number is given is specified in $frombase. Both $from- base and $tobase have to be between 2 and 36, inclusive. Digits in numbers with a base higher than 10 will be represented with the letters a-z, with a meaning 10, b meaning 11 and z meaning 35. Warning base_convert(3) may lose precision on large numbers due to properties related to the internal "double" or "float" type used. Please see the Floating point numbers section in the manual for more specific information and limitations. PARAMETERS
o $number - The number to convert o $frombase - The base $number is in o $tobase - The base to convert $number to RETURN VALUES
$number converted to base $tobase EXAMPLES
Example #1 base_convert(3) example <?php $hexadecimal = 'A37334'; echo base_convert($hexadecimal, 16, 2); ?> The above example will output: 101000110111001100110100 SEE ALSO
intval(3). PHP Documentation Group BASE_CONVERT(3)

Check Out this Related Man Page

GMP_STRVAL(3)								 1							     GMP_STRVAL(3)

gmp_strval - Convert GMP number to string

SYNOPSIS
string gmp_strval (GMP $gmpnumber, [int $base = 10]) DESCRIPTION
Convert GMP number to string representation in base $base. The default base is 10. PARAMETERS
o $gmpnumber - The GMP number that will be converted to a string. Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string provided that it is possible to convert the latter to a number. o $base - The base of the returned number. The default base is 10. Allowed values for the base are from 2 to 62 and -2 to -36. RETURN VALUES
The number, as a string. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.2 | | | | | | | The $base was extended from 2 to 36, to 2 to 62 | | | and -2 to -36. | | | | +--------+---------------------------------------------------+ NOTES
Note To use the extended base introduced in PHP 5.3.2, then PHP must be compiled against GMP 4.2.0 or greater. EXAMPLES
Example #1 Converting a GMP number to a string <?php $a = gmp_init("0x41682179fbf5"); printf("Decimal: %s, 36-based: %s", gmp_strval($a), gmp_strval($a,36)); ?> PHP Documentation Group GMP_STRVAL(3)
Man Page

13 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Convert hexadecimal to decimal base

Hello ! Does anyone knows how can I convert hexadecimal to decimal base in the ksh or csh script ?? Thanks ! Witt (1 Reply)
Discussion started by: witt
1 Replies

2. UNIX for Advanced & Expert Users

Data_DIR=${0%/*/*}/data/

Please explain both these lines Data_DIR=${0%/*/*}/data/ if ] what is the meaning of ${0%/*/*}/data/ and what is the meaning of ] (2 Replies)
Discussion started by: satgur
2 Replies

3. Shell Programming and Scripting

Meaning of code

Hi Can anybody tell me what is the meaning of the following code? i=4 j=1 k=0 Specialy meaning of this line echo $? Specialy meaning of this line echo $? Specialy meaning of this line echo $? Thanks in advance Sas (3 Replies)
Discussion started by: SasDutta
3 Replies

4. AIX

meaning of ${0%${0##*/}}

. ${0%${0##*/}}Script_Name if i issue this command, it is executing the script. can any one tell what is the meaning of ${0%${0##*/}} (7 Replies)
Discussion started by: nyelavarthy
7 Replies

5. Shell Programming and Scripting

need script to convert number in hexadecimal

hi , i need a script to convert number into hexadecimal base for example: 237=>ED it s very important for me thank you in advance for you help (5 Replies)
Discussion started by: mips
5 Replies

6. UNIX for Dummies Questions & Answers

Use and meaning of $*

Can someone explain the use and meaning of "$*" expression. (2 Replies)
Discussion started by: sinpeak
2 Replies

7. UNIX for Dummies Questions & Answers

Breaking a string into four different numbers

I'm having trouble breaking a string into four different numbers. What I'm starting out with is foo='1218141 1441 1664 122222' and what I want to have is a=1218141 b=1441 c=1664 d=122222 I'm tried using some pattern matching to break the string up into these four different... (7 Replies)
Discussion started by: Azumandious
7 Replies

8. UNIX for Dummies Questions & Answers

what the meaning of #*

can some one please tell the meaning of the second statement i.e n=${m#*=} i couldnt get the meaning of the #*= 1.) m="mohit=/c/main/issue" echo $m result ----------- mohit=/c/main/issue 2.) n=${m#*=} echo $n RESULT ------- /c/main/issue (1 Reply)
Discussion started by: narang.mohit
1 Replies

9. Shell Programming and Scripting

Help with shell scripting

HI guys, I need to check the base.txt file with the base.lck file and get a resulting base file which checks the last number in the base.lck file and starts with the number after the numbers in the base.lck file. Here the base.txt is the list of numbers. The base.lck file is something like a... (8 Replies)
Discussion started by: vishva79
8 Replies

10. UNIX for Dummies Questions & Answers

meaning of <<!

Hi all, I wanna know the meaning of the last word "<<! " sudo su - user <<! please help on this !!!! (1 Reply)
Discussion started by: sudharson
1 Replies

11. UNIX for Dummies Questions & Answers

sed one-liner

I have a data base of part numbers: AAA Thing1 BBB Thing2 CCC Thing3 File one is a list of part numbers: AAA234 BBB678 CCC2345 Is there a sed one-line that would compare a data base with and replace the part numbers so that the output looks like this? AAA234 Thing1 BBB678 Thing2... (5 Replies)
Discussion started by: jimmyf
5 Replies

12. Shell Programming and Scripting

[Solved] Decoding a base 64 string

Is it possible to decode a base 64 string in linux or unix. If so, related commands or reference notes would be really helpful. (1 Reply)
Discussion started by: chandu123
1 Replies

13. Programming

C++ : is what the meaning of #include<stdio.h>?

Hello Guys, I'm new in programing line & just started from C++ programs but i don't know the meaning of #include<stdio.h> file....Guys tell me what's the working of this file in C++ program?? I'm confused... Title changed: Please use a descriptive subject text, and not C++?? (3 Replies)
Discussion started by: ggiwebsinfo
3 Replies