https://github.com/nabeghe/alphanum-php
Converting decimal numbers to alphanums, which include uppercase & lowercase letters as well as the underscore character, & vice versa.
https://github.com/nabeghe/alphanum-php
alphanumeric alphanumeric-strings php php-helper php-helpers php-lib php-libraries php-library php-number php-numbers-to-letters php-short-url php-support sexagesimal shortlink
Last synced: about 1 month ago
JSON representation
Converting decimal numbers to alphanums, which include uppercase & lowercase letters as well as the underscore character, & vice versa.
- Host: GitHub
- URL: https://github.com/nabeghe/alphanum-php
- Owner: nabeghe
- License: mit
- Created: 2024-10-22T21:54:56.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-10-22T21:57:02.000Z (7 months ago)
- Last Synced: 2025-04-16T00:58:44.633Z (about 1 month ago)
- Topics: alphanumeric, alphanumeric-strings, php, php-helper, php-helpers, php-lib, php-libraries, php-library, php-number, php-numbers-to-letters, php-short-url, php-support, sexagesimal, shortlink
- Language: PHP
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Alphanum for PHP.
> Converting decimal numbers to alphanums, which include uppercase & lowercase letters as well as the underscore character, & vice versa.
**Notice:** It's useful for shortening links by converting post numbers to alphanumeric characters.
## 🫡 Usage
### 🚀 Installation
You can install the package via composer:
```bash
composer require nabeghe/colory
```
#### Example:
```php
'.Alphanum::generate(0)."\n"; // 0
echo '1 => '.Alphanum::generate(1)."\n"; // 1
echo '10 => '.Alphanum::generate(10)."\n"; // A
echo '11 => '.Alphanum::generate(11)."\n"; // B
echo '12 => '.Alphanum::generate(12)."\n"; // C
echo '13 => '.Alphanum::generate(13)."\n"; // D
echo '14 => '.Alphanum::generate(14)."\n"; // E
echo '100 => '.Alphanum::generate(100)."\n"; // 1f
echo '1000 => '.Alphanum::generate(1000)."\n"; // Gf
echo '1403 => '.Alphanum::generate(1403)."\n"; // NN
echo '2024 => '.Alphanum::generate(2024)."\n"; // Yj
echo '1000000 => '.Alphanum::generate(1000000)."\n"; // 4clf
echo '1000000000 => '.Alphanum::generate(1000000000)."\n"; // 1H9clf
echo 'PHP_INT_MAX => '.Alphanum::generate(PHP_INT_MAX)."\n"; // FFDZXWuKFV7
echo "\n";echo "[[ To Decimal ]]\n";
echo '0 => '.Alphanum::toDecimal('0')."\n"; // 0
echo '1 => '.Alphanum::toDecimal('1')."\n"; // 1
echo 'A => '.Alphanum::toDecimal('A')."\n"; // 10
echo 'B => '.Alphanum::toDecimal('B')."\n"; // 11
echo 'C => '.Alphanum::toDecimal('C')."\n"; // 12
echo 'D => '.Alphanum::toDecimal('D')."\n"; // 13
echo 'E => '.Alphanum::toDecimal('E')."\n"; // 14
echo '1f => '.Alphanum::toDecimal('1f')."\n"; // 100
echo 'Gf => '.Alphanum::toDecimal('Gf')."\n"; // 1000
echo 'NN => '.Alphanum::toDecimal('NN')."\n"; // 1403
echo 'Yj => '.Alphanum::toDecimal('Yj')."\n"; // 2024
echo '4clf => '.Alphanum::toDecimal('4clf')."\n"; // 1000000
echo '1H9clf => '.Alphanum::toDecimal('1H9clf')."\n"; // 1000000000
echo 'FFDZXWuKFV7 => '.Alphanum::toDecimal('FFDZXWuKFV7')."\n"; // PHP_INT_MAX
echo "\n";
```
## 📖 License
Copyright (c) 2024 Hadi Akbarzadeh
Licensed under the MIT license, see [LICENSE.md](LICENSE.md) for details.