1. Go to this page and download the library: Download fab2s/math 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/ */
$n = Math::number('42');
$n->eq('42'); // true — equal
$n->gt('40'); // true — greater than
$n->gte('42'); // true — greater than or equal
$n->lt('50'); // true — less than
$n->lte('42'); // true — less than or equal
$n->isZero(); // false
$n->isPositive(); // true
$n->isNegative(); // false
$n->isEven(); // true
$n->isOdd(); // false
$n = Math::number('42.99');
$n->getScale(); // 2
$n->getIntegralPart(); // '42'
$n->getFractionalPart(); // '99'
// From base X to base 10
Math::fromBase('LZ', 62); // '1337'
Math::fromBase('101010', 2); // '42'
Math::fromBase('ff', 16); // '255' (case-insensitive for bases <= 36)
// From base 10 to base X
Math::number('1337')->toBase(62); // 'LZ'
Math::number('42')->toBase(2); // '101010'
Math::number('255')->toBase(16); // 'ff'
// Negative numbers preserve their sign
Math::number('-42')->toBase(16); // '-2a'
Math::fromBase('-LZ', 62); // '-1337'