PHP code example of delight-im / base-convert

1. Go to this page and download the library: Download delight-im/base-convert library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

delight-im / base-convert example snippets


     

\Delight\BaseConvert\Base::convert(
    '101111000110011100011101110001110011100001000100010100111110',
    2,
    27
); // string(13) "5HH1KDF77JELE"

// or

\Delight\BaseConvert\Base::convert(
    '2634460662',
    8,
    16
); // string(8) "167261B2"

// or

\Delight\BaseConvert\Base::convert(
    'BC671DC7384453E',
    16,
    10
); // string(18) "848490771450709310"

\Delight\BaseConvert\Alphabet::convert(
    '219',
    \Delight\BaseConvert\Alphabet::DECIMAL,
    \Delight\BaseConvert\Alphabet::ALPHANUMERIC_HUMAN
); // string(2) "Fw"

// or

\Delight\BaseConvert\Alphabet::convert(
    '1068880747392',
    \Delight\BaseConvert\Alphabet::DECIMAL,
    \Delight\BaseConvert\Alphabet::BINARY
); // string(40) "1111100011011110010000011101101110000000"

// or

\Delight\BaseConvert\Alphabet::convert(
    '3012001200067890000406780000912050034500',
    \Delight\BaseConvert\Alphabet::DECIMAL,
    \Delight\BaseConvert\Alphabet::ALPHANUMERIC_HUMAN
); // string(26) "4tYhrL3q7ydJrqrj4hp7WjHkWJ"

// or

\Delight\BaseConvert\Alphabet::convert(
    '4562245003000071200000100340005636710000',
    \Delight\BaseConvert\Alphabet::OCTAL,
    \Delight\BaseConvert\Alphabet::DECIMAL
); // string(36) "784790447634685127626847041410011136"

// or

\Delight\BaseConvert\Alphabet::convert(
    '127000450089A00000000BCD00604500323EF100',
    \Delight\BaseConvert\Alphabet::HEX,
    \Delight\BaseConvert\Alphabet::DECIMAL
); // string(48) "105259540817262448627958480599765632799008026880"

// or

\Delight\BaseConvert\Alphabet::convert(
    'rxmMbcWYNVfH',
    \Delight\BaseConvert\Alphabet::ALPHA_HUMAN,
    \Delight\BaseConvert\Alphabet::DECIMAL
); // string(19) "1413192387433400246"

// or

\Delight\BaseConvert\Alphabet::convert(
    "\x44\x25\x31\x3d",
    \Delight\BaseConvert\Alphabet::BYTE,
    \Delight\BaseConvert\Alphabet::OCTAL
); // string(11) "10411230475"

\Delight\BaseConvert\Alphabet::ALPHA;
\Delight\BaseConvert\Alphabet::ALPHA_HUMAN;
\Delight\BaseConvert\Alphabet::ALPHA_LOWERCASE;
\Delight\BaseConvert\Alphabet::ALPHA_LOWERCASE_HUMAN;
\Delight\BaseConvert\Alphabet::ALPHA_UPPERCASE;
\Delight\BaseConvert\Alphabet::ALPHA_UPPERCASE_HUMAN;
\Delight\BaseConvert\Alphabet::ALPHANUMERIC;
\Delight\BaseConvert\Alphabet::ALPHANUMERIC_AND_PUNCTUATION_HUMAN;
\Delight\BaseConvert\Alphabet::ALPHANUMERIC_HUMAN;
\Delight\BaseConvert\Alphabet::ALPHANUMERIC_LOWERCASE;
\Delight\BaseConvert\Alphabet::ALPHANUMERIC_LOWERCASE_HUMAN;
\Delight\BaseConvert\Alphabet::ALPHANUMERIC_UPPERCASE;
\Delight\BaseConvert\Alphabet::ALPHANUMERIC_UPPERCASE_HUMAN;
\Delight\BaseConvert\Alphabet::ASCII_PRINTABLE;
\Delight\BaseConvert\Alphabet::ASCII_PRINTABLE_HUMAN;
\Delight\BaseConvert\Alphabet::BASE_32;
\Delight\BaseConvert\Alphabet::BASE_58;
\Delight\BaseConvert\Alphabet::BASE_64;
\Delight\BaseConvert\Alphabet::BASE_64_URL;
\Delight\BaseConvert\Alphabet::BASE_85;
\Delight\BaseConvert\Alphabet::BINARY;
\Delight\BaseConvert\Alphabet::BYTE;
\Delight\BaseConvert\Alphabet::DECIMAL;
\Delight\BaseConvert\Alphabet::DUODECIMAL;
\Delight\BaseConvert\Alphabet::DUODECIMAL_LOWERCASE;
\Delight\BaseConvert\Alphabet::DUODECIMAL_UPPERCASE;
\Delight\BaseConvert\Alphabet::HEX;
\Delight\BaseConvert\Alphabet::HEX_LOWERCASE;
\Delight\BaseConvert\Alphabet::HEX_UPPERCASE;
\Delight\BaseConvert\Alphabet::OCTAL;
\Delight\BaseConvert\Alphabet::QUATERNARY;
\Delight\BaseConvert\Alphabet::QUINARY;
\Delight\BaseConvert\Alphabet::SENARY;
\Delight\BaseConvert\Alphabet::TERNARY;
\Delight\BaseConvert\Alphabet::VIGESIMAL;
\Delight\BaseConvert\Alphabet::VIGESIMAL_LOWERCASE;
\Delight\BaseConvert\Alphabet::VIGESIMAL_UPPERCASE;